vakata / jstree

jquery tree plugin
http://jstree.com
MIT License
5.15k stars 1.38k forks source link

Using custom JSON format as URL response #2608

Closed tfrancart closed 2 years ago

tfrancart commented 2 years ago

Hello, I would like to use the url parameter to fetch the children of a node from an existing API that does not return directly the data structure expected by JSTree. I need to transform it a little bit before passing it to JSTree. However I see that JSTree takes directly the response of the URL and tries to insert it in the tree (here : https://github.com/vakata/jstree/blob/master/src/jstree.js#L1476)

Can I provide a data transformation function that would transform the JSON returned by the URL and pass it to JSTree ?

Thanks !

tfrancart commented 2 years ago

Just used the other loading technique with a function as the parameter of the "data" config, do the ajax call myself and transform the result before calling the callback.