EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: MB34 on April 23, 2015, 10:43:05 AM



Title: Help setting select editor
Post by: MB34 on April 23, 2015, 10:43:05 AM
I am using the datagridview. I do not know how to correctly setup an editor for the Type column. I want a dropdown like this:
Code:
<select>
    <option value-"0">OL</option>
    <option value-"1" selected>CR</option> <!-- selected if value in field is 1 -->
    <option value-"2">WB</option>
</select>

Here's the columns code:

Code:
    columns:[[
        {field:'prg_code',title:'Prg Code',width:80,sortable:true},
        {field:'state',title:'State',width:100,sortable:true},
        {field:'type',title:'Type',width:80,align:'right',
            editor:{type:'combobox',
                options:{valueField:'type',
                        textField:'type',
                        data:[{txt:'OL',val:'0'},{txt:'CR',val:'1'},{txt:'WB',val:'2'}]
                        }
                }
            }
    ]],
Here's the fiddle:
http://jsfiddle.net/Mrbaseball34/qdt8t7jr/ (http://jsfiddle.net/Mrbaseball34/qdt8t7jr/)


Title: Re: Help setting select editor
Post by: stworthy on April 23, 2015, 06:00:17 PM
When using the 'combobox' editor, take care to set the 'valueField' and 'textField' properties correctly.
Code:
editor:{
type:'combobox',
options:{
valueField:'val',
textField:'txt',
data:[{txt:'OL',val:'0'},{txt:'CR',val:'1'},{txt:'WB',val:'2'}]
}
}

Please refer to the updated example http://jsfiddle.net/qdt8t7jr/28/


Title: Re: Help setting select editor
Post by: MB34 on April 23, 2015, 08:02:21 PM
When using the 'combobox' editor, take care to set the 'valueField' and 'textField' properties correctly.

Well, I hate to say it but your documentation is very poor. There are no examples IN THE DOCUMENTATION and few in the tutorials section and the ones you have there are fairly limited in scope.

But thanks for the help anyway, you have a great library.


Title: Re: Help setting select editor
Post by: stworthy on April 23, 2015, 08:26:09 PM
Please take care to find your answer on the site. There are many examples available from http://www.jeasyui.com/demo/main/index.php?plugin=DataGrid&theme=default&dir=ltr&pitem=Row%20Editing%20in%20DataGrid