arvindr21 / jsTree-directive

An Angular Directive for jsTree. Docs :
http://jstree-directive.herokuapp.com/
51 stars 33 forks source link

Issue with 2 trees, one of them loaded with state plugin #19

Closed johaven closed 7 years ago

johaven commented 9 years ago

If multiple trees are loaded and one of them will have the state parameter. Errors between the trees occur when traverses the same folders.

TypeError: a.state is undefined ...d:function(a){return a=this.get_node(a),a&&a.state.loaded},is_loading:function(a...

or

TypeError: this._model.data[b].state is undefined ...model.data.hasOwnProperty(b)&&"#"!==b&&(this._model.data[b].state.opened&&a.core...

arvindr21 commented 9 years ago

Can you please share a fiddle with the issue?

johaven commented 9 years ago

Finally, It's happen when i have 2 path open in a same root folder and i refresh or reload tree.

To test: expand two nodes of the same root folder and refresh with $('#tree').jstree(true).refresh() - many times if possible.

johaven commented 9 years ago

This is confirmed by the developer of jstree, it comes right jstree Directive. it is not related to the state plugin. With the last version of Jstree in master branch, i got this error:

TypeError: f.id.replace is not a function ...str(1).replace(a.jstree.idregex,"\$&"):f.id.replace(a.jstree.idregex,"\$&"))):...

How to reproduce:

arvindr21 commented 9 years ago

Oh! ok. Any proposed fix for this issue?

johaven commented 9 years ago

Not yet had time to dissect the code, but it should be easy for you I think? Do you have a proposal to refresh the tree in another way?

arvindr21 commented 9 years ago

As of now, I do not have a solution for this. May be you could save last opened children nodes in local storage and open the tree nodes till this level recursively? I don't know, may not be the correct way to do it.

Do let me know if you find a fix for this. Thanks!