EasyUI Forum
May 16, 2024, 12:35:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Help setting select editor  (Read 6129 times)
MB34
Newbie
*
Posts: 20


View Profile
« 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/
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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/
Logged
MB34
Newbie
*
Posts: 20


View Profile
« Reply #2 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!