oncreate should fire after each node is create with JSON?

114 views
Skip to first unread message

Shandem

unread,
May 12, 2009, 8:38:37 AM5/12/09
to jsTree
There doesn't seem to be a callback that fires when each JSON node is
converted/created by jsTree into a real DOM object. I would like to be
able to modify the node each time jsTree converts a JSON data node to
a real node. oncreate does not seem to fire when this happens, is this
by design, or is there a way to acheive this?

vakata

unread,
May 13, 2009, 1:36:19 PM5/13/09
to jsTree
Hi,

oncreate fires only when a node is created using the create function.
Maybe you need onload (or possibly onopen if you use async).

Cheers,
Ivan

Shandem

unread,
May 13, 2009, 8:01:39 PM5/13/09
to jsTree
Hi,

I am using async but am loading the initial data for the tree via
configuration and then additional data is pulled in with json. I need
to modify the markup of a node depending on the metadata that exists
in a node. Specifically, i need to insert a div before the a in the li
of a node if the metadata for the node has some specific information.
Will onopen will work for this scenario?

Cheers!

vakata

unread,
May 15, 2009, 4:44:36 AM5/15/09
to jsTree
I do not recommend modifying the HTML structure. Anyway - I must test
and let you know if that will work.
Cheers,
Ivan

Shandem

unread,
May 17, 2009, 7:08:32 PM5/17/09
to jsTree
I've accomplished this and posted in this thread:
http://groups.google.com/group/jstree/browse_thread/thread/3ef53bf7e5e2932d?hl=en

The information i posted isn't exactly what i've used as i've modified
it to suit. Seems to work well.

Cheers
Reply all
Reply to author
Forward
0 new messages