EasyUI Forum
May 05, 2024, 08:18:09 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Filter event  (Read 9949 times)
A-K
Full Member
***
Posts: 122


View Profile WWW
« on: February 02, 2015, 08:00:36 AM »

Hey,

I didnt find a way to know when a user has filtered the datagrid, is there an event that I missed?
I only saw the onClickMenu in the extension.

Thanks.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: February 02, 2015, 05:02:19 PM »

After calling the 'doFilter' method, the filtered data will be loaded. When this happens, the 'onLoadSuccess' event fires.
Logged
A-K
Full Member
***
Posts: 122


View Profile WWW
« Reply #2 on: February 02, 2015, 10:55:24 PM »

But I am not calling doFilter.  I just enabled filters on the
datagrid and I need to know when the user has filtered
the datagrid,  like for example when he typed something
in any column.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: February 02, 2015, 11:52:00 PM »

The 'doFilter' method is called internally. Once the filtering action is finished, the 'onLoadSuccess' event fires.
Logged
A-K
Full Member
***
Posts: 122


View Profile WWW
« Reply #4 on: February 03, 2015, 03:36:37 AM »

Oh but there is a small problem with this situation, I have a lot of code in the onLoadSuccess which I am using
when the datagrid is loaded but I do not want to use it when the user has filterd the datagrid.

Could you create an event for the filter so I could at least use a bool to know when its from the filter...

Thanks.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #5 on: February 03, 2015, 09:06:48 AM »

Please try to detect the 'filterRules' property value in the 'onLoadSuccess' event. If the 'filterRules' is not empty, the data should be loaded from the filters.
Code:
$('#dg').datagrid({
onLoadSuccess:function(data){
var opts = $(this).datagrid('options');
console.log(opts.filterRules)
}
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!