|
Title: bug in tree Post by: A-K on December 13, 2014, 05:47:40 AM Hey,
I found a problem in the tree, When using loader in the tree everything works great. It will first call the "onBeforeLoad" and only then it will call the "onLoadSuccess". But when using data instead of loader it will first call the "onLoadSuccess" and only then the "onBeforeLoad" which is clearly a problem. Using loader: http://jsfiddle.net/9kfg5y02/3/ (http://jsfiddle.net/9kfg5y02/3/) Using data: http://jsfiddle.net/9kfg5y02/4/ (http://jsfiddle.net/9kfg5y02/4/) Any fix for this would really help, Thanks! Title: Re: bug in tree Post by: jarry on December 13, 2014, 07:19:02 AM When a tree is created, it will load the locale data first(if the 'data' property is assigned) and then try to load remote data.
In the second example, the 'data' property is assigned, so the 'onLoadSuccess' event fires. Finally, the tree will try to load remote data, the 'onBeforeLoad' event fires but the 'onLoadSuccess' event does not fire again since the 'url' property is not assigned. Title: Re: bug in tree Post by: A-K on December 13, 2014, 07:58:24 AM I understand what you are saying but it is making it more complicated to work with the tree,
can it call onBeforeLoad for local data? and can it not call onBeforeLoad again when no remote data was assigned? I am using a tree as an infrastructure for my team and I would need to check every time if they used data or loader for using onLoadSuccess and onBeforeLoad correctly.. Thanks. Title: Re: bug in tree Post by: jarry on December 14, 2014, 04:45:12 AM Loading locale data does not trigger the onBeforeLoad event. This event fires only when a request is made to load remote data.
Title: Re: bug in tree Post by: A-K on December 14, 2014, 09:30:21 AM I cant understand why.. I have a code that I want to run before loading any data to the tree(doesnt matter if its from the server or local),
this is the only place I can do it before the data is loaded as an infrastructure. but anyway, thanks. Title: Re: bug in tree Post by: jarry on December 14, 2014, 05:33:55 PM You can try to use the 'loadFilter' function, which will be called before loading data to the tree.
Code: $('#tt').tree({ |