EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: WizPS on December 07, 2019, 03:42:47 PM



Title: how to get a is_DataGrid_Filter_Row true/false property out-of the datagrid?
Post by: WizPS on December 07, 2019, 03:42:47 PM
Using "DataGrid Filter Row" extension, I want to toggle the Filter Row on and off. How can I do that?
My code turning the filter row on and off works and it looks like this:
Code:
function dg_clickHeaderMenu(target) {
menu.menu('appendItem', { text: 'Filter', handler: function () { dg.datagrid('enableFilter'); } });
menu.menu('appendItem', { text: 'No filter', handler: function () { dg.datagrid('disableFilter'); } });
menu.menu('show', {left: 25 + $(target).offset().left, top: -(0) - 10 + $(target).offset().top, align: 'right' });
}

However I want to make it conditionally so either "Filter" or "No filter" is shown dependant on if the filter is there.  

So what I would like to have is something similar to:
Code:
function dg_clickHeaderMenu(target) {
var filter = ???
if (filter) {
menu.menu('appendItem', { text: 'No filter', handler: function () { dg.datagrid('disableFilter'); } });
} else {
menu.menu('appendItem', { text: 'Filter', handler: function () { dg.datagrid('enableFilter'); } });
}
}

menu.menu('show', {left: 25 + $(target).offset().left, top: -(0) - 10 + $(target).offset().top, align: 'right' });
}

where my question is - how do I get the "DataGrid Filter Row" true / false property out-of the datagrid plugin?


Title: Re: how to get a is_DataGrid_Filter_Row true/false property out-of the datagrid?
Post by: jarry on December 09, 2019, 02:39:14 AM
Please call 'isFilterEnabled' method to detect if the filter is enabled. Make sure to download the newest 'datagrid-filter.js' file from https://www.jeasyui.com/extension/datagrid_filter.php


Title: Re: how to get a is_DataGrid_Filter_Row true/false property out-of the datagrid?
Post by: WizPS on December 09, 2019, 01:02:49 PM
Works fine now. Many thanks!