EasyUI Forum
May 19, 2024, 10:04:32 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: pre-process an event [Solved]  (Read 5309 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: December 05, 2014, 04:50:34 AM »

Is it possible to process all events for an object and then allow subsequent occurrences to also process the event afterwards:

Code:
$.extend($.fn.tabs.defaults, {
  onSelect: function(title){
    ...do something for all events
  }
})

$('#mytab').tabs({
  onSelect: function(){
   ...do something just for this event
  }
})

so that "...do something for all events" is always processed first for all tabs even if they have a onSelect() function ?
« Last Edit: December 06, 2014, 09:20:52 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: December 05, 2014, 07:03:54 AM »

Please try this:
Code:
$('#mytab').tabs({
onSelect:function(title){
$.fn.tabs.defaults.onSelect.call(this, title);
console.log('do something just for this event');
}
})
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: December 05, 2014, 05:56:32 PM »

Thanks so much, but I am trying to do it the other way around so that I do not have to change all of the existing pages which already use the tabs.onChange() event.

Is it possible to extend the tabs so that it performs the pre-process before calling the onChange() without having to modify all of the other pages that make use of the onChange event ?

I guess what I am really looking for is an onBeforeSelect() type event.
« Last Edit: December 05, 2014, 07:31:52 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: December 06, 2014, 05:57:49 AM »

The 'onBeforeOpen' event of panel fires before the 'onSelect' event of tabs. It can be used to perform your pre-processing before selecting a tab panel.
Code:
var mytab = $('#mytab').tabs({...});  // create the tabs component
$.each(mytab.tabs('tabs'), function(index,p){
p.panel('options').onBeforeOpen = function(){
console.log('do something before selecting the panel');
}
});
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!