EasyUI Forum
May 20, 2024, 04:30:53 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Datagrid: fire onLoadSuccess just once  (Read 7864 times)
Juan Antonio Martínez
Jr. Member
**
Posts: 68



View Profile
« on: February 02, 2015, 05:53:09 AM »

Hi all
Any easy way to fire datagrid onLoadSuccess just once?

Something like:
Code:
function loadAndFire() {
$('#my-datagrid').datagrid(
        'load',
        {
         Prueba: workingData.prueba,
         Jornada: workingData.jornada ,
         Manga: workingData.manga ,
         Operation: 'getData'
        }
).done(function(data) {myFiredFunction(data);} );
}

Thanks in advance
Juan Antonio
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 02, 2015, 06:47:18 PM »

You must define 'onLoadSuccess' event in the datagrid component before using it.
Code:
$('#my-datagrid').datagrid({
onLoadSuccess:function(data){
//...
}
});
$('#my-datagrid').datagrid(
    'load',
    {
    Prueba: workingData.prueba,
    Jornada: workingData.jornada ,
    Manga: workingData.manga ,
    Operation: 'getData'
    }
);
Logged
Juan Antonio Martínez
Jr. Member
**
Posts: 68



View Profile
« Reply #2 on: February 03, 2015, 09:22:02 AM »

Sorry, perhaps my question was a bit malformed:

my code is something like:

Code:
function one() {
   ....
   $(dg).datagrid('load',data1);
   return;
}
function two() {
   ....
   $(dg).datagrid('load',data2);
   /* something to do AFTER load success */
   ....
}
function three() {
   ....
   $(dg).datagrid('load',data3);
   return;
}

I want to be able to call onLoadSuccess(), but only on function two(). Due to async nature of ajax call in 'load', I cannot simply add required code bellow

So I'm looking for:
- A way to enable/disable onLoadSuccess at an specific point, without affecting others
Or
- Add a sort of method like datagrid('load').done()

Juan Antonio
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!