Treetable dynamic loading : Can't pass dynamic url in loadBranch

Hi,

When dynamically loading treetable branch,
I need to pass a dynamically generated url based on the id to the loadbranch url :

on: { onBeforeOpen: function (id) { // if children have not been loaded yet if (this.getItem(id).$count === -1) { custom_url = '/foo/'+id+'/bars'; this.loadBranch(id, null, custom_url); } } }

But this don’t work because the url is cached in the loadBranch method and in next onBeforeOpen call, the loadbranch will not use the new url given, but use the cached one (the first one)
This is clearly visible in loadBranch code :

loadBranch:function(id, callback, url){ id = id ||0; this.data.url = this.data.url || url; if (this.callEvent("onDataRequest", [id,callback,this.data.url]) && this.data.url) this.data.feed.call(this, id, 0, callback); },

We can see that this.data.url = this.data.url || url; make cached url prevail on the given url.

My opinion is that the given url should prevail on the cached url.

Thanks

PS : The workaround is to use the “onDataRequest” way :
http://docs.webix.com/datatree__dynamic_loading.html#redefiningondatarequestevent

Hi,

please check the demo Dynamic Loading. Tree sends data requests. There is not need to set onBeforeOpen handler. All you need is to set onDataRequest event handler to send custom ajax request:

webix.ui({
    view:"tree",
    url: "....",
    on:{
	"onDataRequest": function(id, callback, url){
             url = ...;
             webix.ajax(url, callback, this);
             return false;
         }
     }
});

My opinion is that the given url should prevail on the cached url.

We will consider this issue.