EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Pierre on February 15, 2017, 02:30:13 PM



Title: [SOLVED] DataGrid Combo Editor
Post by: Pierre on February 15, 2017, 02:30:13 PM
Hello
I need to use Combobox as Editor (in datagrid) for some products and for some not.
With other words, for some products I need "Red", "Blue", "Orange" color and for some products it must be only "No color" option.
How to do that, please?
Thank you.


Title: Re: DataGrid Combo Editor
Post by: stworthy on February 16, 2017, 01:11:33 AM
You can change the edition options before editing a row.
Code:
$('#dg').datagrid({
  onBeforeEdit:function(index,row){
    var col = $(this).datagrid('getColumnOption','productid');
    col.editor = {
      type:'combobox',
      options:{
        data:[{
          value:'Red',
          text:'Red'
        },{
          value:'Blue',
          text:'Blue'
        }]
      }
    }
  }
})


Title: Re: DataGrid Combo Editor
Post by: Pierre on February 16, 2017, 12:04:19 PM
Awesome, thank you so much.  ;D