EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: gtoma on March 07, 2014, 03:34:10 AM



Title: datagrid global event listener
Post by: gtoma on March 07, 2014, 03:34:10 AM
Hi all,

i want to put in datagrid, and much button.

i have a global event listener:
(simplifying)
Code:
$(document).on('click', function() { 
   console.log('trallala');
    …
}); 

what happens:
Loading the page, and run the listener.

An onclick event add a datagrid.

The datagrid formatter add buttons for all row.

error:
The global event listener dont catch on the buttons.

how can i enabled this global event listener?

te real event listener:
Code:
$(document).on('click', '[data-ajaxobj]:not([data-ajaxobj=""])', function(){   
      console.log('opopo'); 
      var json = $(this).data('ajaxobj');var win = $(this).data('win');         
      if( !$.isPlainObject(json) || typeof json !== 'object' ) {json = jQuery.parseJSON( json.replace(/'/g, '"') );} 
          if( win != "" && win != undefined) { 
              if( AdminControll.Windows[win] == undefined  ) {AdminControll.addWindow( json );   
              } else {AdminControll.Windows[win].AjaxObj.Start( json );} 
          } else {new AjaxObj().Start( json );} 
      return false; 
});