EasyUI Forum

General Category => Bug Report => Topic started by: Stefan B. on June 13, 2014, 06:50:53 AM



Title: Datagrid row filter - remote filter should not called if no filtervalue changed
Post by: Stefan B. on June 13, 2014, 06:50:53 AM
We used the default row filter from type=text and the filter fetch remote data after the delay of 1000
Code:
remoteFilter: true,
filterDelay: 1000

But the filter also fetch remote data if the filter text not changed!
Exsample: Click on the filter textfield and then only navigate in the filtertext, or you select part of filtertext with keyboard arrows.

I have seen in the datagrid-filter.js file, that all key events used to call the doFilter() method!
This should only done if the filter value changed or enter is pressed!

Code:
				input.unbind('.filter').bind('keydown.filter', function(e){
var t = $(this);
if (this.timer){
clearTimeout(this.timer);
}
if (e.keyCode == 13){
_doFilter();
} else {
this.timer = setTimeout(function(){
_doFilter();
}, opts.filterDelay);
}
});


I think this shoud be done only when the filter value changed


Title: Re: Datagrid row filter - remote filter should not called if no filtervalue changed
Post by: stworthy on June 13, 2014, 08:40:46 AM
You can override the $.fn.datagrid.defaults.defaultFilterOptions, or download the updated 'datagrid-filter.js' file from http://www.jeasyui.com/extension/datagrid_filter.php


Title: Re: Datagrid row filter - remote filter should not called if no filtervalue changed
Post by: Stefan B. on June 15, 2014, 11:34:55 PM
Hello. Now I used the updated 'datagrid-filter.js'.
That works better.

But if no text is in the textbox, the doFilter() methode is every time called if i press any key. So if i go with tab-key from one to the next column filter the remote filter is also called