EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on May 21, 2014, 06:30:15 AM



Title: setting a method without initializing [Solved]
Post by: devnull 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...}



Title: Re: setting a method without initializing
Post by: jarry 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(){...}