Title: datagrid search field clear button Post by: rezzonico on November 27, 2017, 02:46:38 AM Hi all,
I have a datagrid with (suppose) only one column (Assetnum). After the datagrid is created I call enableFilter with the following options: $('#dg').datagrid('enableFilter', [ { field: 'Assetnum', type: 'combotree', options: { editable: true, valueField: 'Assetnum', textField: 'Assetnum', url: 'prog.cgi', onChange: function(value) { if (value == '') { $('#dg').datagrid('removeFilterRule', 'Assetnum'); } else { $('#dg').datagrid('addFilterRule', { field: 'Assetnum', value: value }); } $('#dg').datagrid('doFilter'); } } } After that I add a clear-icon near the search field: $('#_easyui_textbox_input1').textbox({ icons:[{ iconCls: 'icon-clear', handler: function(e) { $('#dg').datagrid('removeFilterRule', 'Assetnum'); } }] }); The problem is that this only works if the option editable is set to true (see red line above). If editable is false, also 'icon-clear' is disabled and the handler function (see green line above) is not executed. My question is this: Is it possible to disable the search field "Assetnum" but not the handler function ? Thanks for any help Miche Title: Re: datagrid search field clear button Post by: jarry on November 27, 2017, 06:46:27 PM The code below attaches a 'clear' icon to the editor. You can click the 'clear' button although the 'editable' is set to false.
Code: editable: false, Title: Re: datagrid search field clear button Post by: rezzonico on November 28, 2017, 03:35:47 AM It works !
Thanks a lot. Miche |