jsTree inside of a jquery tab

97 views
Skip to first unread message

Manuel Bernhardt

unread,
Mar 9, 2011, 10:45:55 AM3/9/11
to jsTree
Hi all,

first off, thanks for the great jsTree script!

I have the following scenario:
- I have one jsTree at the left of my page which contains a couple of
nodes. When a node is selected, it will cause a refresh of the content
of a tab on the right side of the page
- the tabs on the right side of my page are done via the jquery tabs()
plugin and the content is loaded via AJAX calls
- the above works well with most content in the tabs

I now have a new tab that itself contains a jsTree, and that's where
things get messy. When I load the tab with the jsTree for the first
time, all is well and the tree renders correctly. Now when I try to
load it for the second time (with different data, by e.g. selecting a
different node in my left tree), I get a "data is undefined" in
FireFox, and then there is no way to render the jsTree in the tab
anymore.

I suspect that something goes wrong with the reloading, but I'm not
sure what to do about it.

I'm using jQuery 1.4.4 and the latest version of jsTree (from SVN)

If anyone has an idea what to do to solve this, I would be very glad!

Thanks!

Manuel

Manuel Bernhardt

unread,
Mar 14, 2011, 6:12:50 AM3/14/11
to jsTree
Hi guys,

in the meanwhile I managed to fix the issue myself.

The problem was that I had a call (copy-pasted from the example)
handling the removal of nodes:

.bind("remove.jstree", function (e, data) {
data.rslt.obj.each(function () {
...
}
}

And the "remove()" method would be called when my tabs tried to remove
the tree, which wouldn't work because no data was passed...

So, I used the "delete_node" method instead and now all works fine.

Cheers!

Manuel

> --
> You received this message because you are subscribed to the Google Groups "jsTree" group.
> To post to this group, send email to jst...@googlegroups.com.
> To unsubscribe from this group, send email to jstree+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jstree?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages