EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: reneH on April 16, 2021, 05:35:14 AM



Title: remote Filter automatic
Post by: reneH on April 16, 2021, 05:35:14 AM
Hi,

I am using the datagrid Filter extension in my application.

remoteFilter is activated and works fine.

Is it possible to run "doFilter" method while typing  ???
It just work, when I have no filter option in selection. I want to "doFilter" with a default option.
However, I still want to be able to choose different options.


Thanks !


Title: Re: remote Filter automatic
Post by: jarry on April 16, 2021, 04:27:21 PM
When using the 'remote' mode, you can modify the query params when posing data.
Code:
$('#dg').datagrid({
onBeforeLoad: function(params){
console.log(params)
}
});
You can also call 'addFilterRule' method to add some filter rules before 'doFilter'.


Title: Re: remote Filter automatic
Post by: reneH on April 19, 2021, 04:11:21 AM
Thanks for your help  !

But how I get it, that "doFilter" will be executed while typing (or when lost focus) in Filter Column ?


Title: Re: remote Filter automatic
Post by: jarry on April 20, 2021, 07:43:33 PM
Please look at this code. You can attach the input events on the filtering box.
Code:
dg.datagrid('enableFilter', [{
field:'listprice',
type:'numberbox',
options:{
precision:1,
inputEvents: $.extend({}, $.fn.numberbox.defaults.inputEvents, {
blur: function(e){
$.fn.numberbox.defaults.inputEvents.blur(e);
// ...
}
})
},
op:['equal','notequal','less','greater']
}])