EasyUI Forum

General Category => General Discussion => Topic started by: rangaNadha on March 04, 2018, 11:32:03 PM



Title: Change Combobox Filter options in Datagrid dynamically
Post by: rangaNadha on March 04, 2018, 11:32:03 PM
Hi,

We have a requirement saying that Enable/Disable the options in combo box filter dynamically for a datagrid on selecting a radio button outside the datagrid.

Could you Please tell me the process how to do that.

Thanks in Advance.

Thanks,
Pandu Ranga T.


Title: Re: Change Combobox Filter options in Datagrid dynamically
Post by: jarry on March 05, 2018, 07:22:16 AM
Set the 'editable' property to true to enable the filter or false to disable it.
Code:
$('#cc').combobox({
  editable: true  // or false
});


Title: Re: Change Combobox Filter options in Datagrid dynamically
Post by: rangaNadha on March 05, 2018, 09:59:04 PM
Hi Jarry,

Its not the enable/disable the filter for a particular combobox.

We have to enable/disable the option in the combobox based on a radio button selection.

Code:

{
 field:'column',
 type:'combobox',
 options:{
panelHeight:'auto',
data:[
   {value:'',text:$("#all").text()},
   {value:'01',text:$("#confirmed").text()},
   {value:'02',text:$("#waitList").text()},
   {value:'03',text:$("#cancelled").text(), disabled: true}, // We need to change disabled attribute onSelecting a radio button outside the grid.
   {value:'04',text:$("#checkedIn").text()},
   {value:'06',text:$("#open").text()}
  ]
}
}


Thanks in advance.


Title: Re: Change Combobox Filter options in Datagrid dynamically
Post by: jarry on March 06, 2018, 02:26:35 AM
Please try to call the 'getFilterComponent' method to get the filter component and load new data.
Code:
var data = [
{value:'',text:$("#all").text()},
{value:'01',text:$("#confirmed").text()},
{value:'02',text:$("#waitList").text()},
{value:'03',text:$("#cancelled").text(), disabled: true},
{value:'04',text:$("#checkedIn").text()},
{value:'06',text:$("#open").text()}
];
var dg = $('#dg');
var c = dg.datagrid('getFilterComponent', 'column');
c.combobox('loadData', data);


Title: Re: Change Combobox Filter options in Datagrid dynamically
Post by: rangaNadha on March 06, 2018, 10:20:26 PM
Thanks Jarry, it satisfied our requirement.