EasyUI Forum
May 16, 2024, 03:47:13 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: setting a method without initializing [Solved]  (Read 5724 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: May 21, 2014, 06:30:15 AM »

Is it possible to set the method of a SINGLE object after it has been initialized:

This sets the default behavior for ALL objects:
Code:
$.extend($.fn.tree.defaults, {
  onBeforeLoad: function(node,param){
  }
})

This will set the method for a SINGLE element, but it will also cause the method to fire:
Code:
$('#tt').tree({
  onBeforeLoad: function(node,param){
  }
})

Can I set the method on a SINGLE object which has already been initialized without it triggering the event:

Code:
$('#tt').tree().onBeforeLoad = function(node,param){do something...}

« Last Edit: May 21, 2014, 04:50:24 PM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: May 21, 2014, 07:13:53 AM »

You can call 'options' method to get the options of a object. Some properties such as 'onBeforeLoad' can be modified directly on this 'options' object. Try this:
Code:
$('#tt').tree('options').onBeforeLoad = function(){...}
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!