EasyUI Forum
May 10, 2024, 08:04:13 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: onLoadSuccess is called twice with filter extension  (Read 11936 times)
A-K
Full Member
***
Posts: 122


View Profile WWW
« on: August 19, 2014, 08:35:07 AM »

Hey, Is there a reason that when using the filter extension the 'onLoadSuccess' will be called twice,
once when the real data is loaded and once when the enable filter code runs (
Code:
$('#dg').datagrid('enableFilter');
)

Its making my code not efficient because I have some serious code in the 'onLoadSuccess' and because
of this I need to check if its called once or twice which makes the code look really bad...

Thanks, Alon.
« Last Edit: August 19, 2014, 08:36:56 AM by AlonKatz » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 19, 2014, 07:28:43 PM »

The 'datagrid-filter.js' has been improved, please download it from http://www.jeasyui.com/extension/datagrid_filter.php
Logged
A-K
Full Member
***
Posts: 122


View Profile WWW
« Reply #2 on: August 19, 2014, 10:13:48 PM »

Thanks, the problem is fixed.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #3 on: September 01, 2014, 06:35:18 AM »

I have the same problem! *And it is NOT fixed with the extension file from today.*
I'am using remote filter and the remote data is loaded twice! And the the onLoadSuccess is called also twice.

It is only a problem if I enable the filter!
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #4 on: September 01, 2014, 07:21:22 AM »

If you have the 'filterRules' property initialized, the data will be loaded again when calling 'enableFilter' method.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #5 on: September 01, 2014, 11:19:45 PM »

OK. But this is what we should done. Jerry wrote this on the bug report http://www.jeasyui.com/forum/index.php?topic=3698.0
So, every time we enable the filte we do something like this
Code:
$('#dg1').datagrid({filterRules:[]}).datagrid('enableFilter');
$('#dg2').datagrid({filterRules:[]}).datagrid('enableFilter');

I try to remove the code datagrid({filterRules:[]}) , and then it fixed!

But what should we do with the bug on http://www.jeasyui.com/forum/index.php?topic=3698.0 Huh

Update: In the datagrid-filter.js the was the line 477 commented out. Is that the correct code to init the filter and fix the other bug?
« Last Edit: September 01, 2014, 11:31:27 PM by Stefan B. » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #6 on: September 02, 2014, 12:40:18 AM »

The 'datagrid-filter.js' has been updated, please try to download it from http://www.jeasyui.com/extension/datagrid_filter.php.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #7 on: September 02, 2014, 01:08:05 AM »

THX - That works.
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!