ezraroi/ngJsTree

Can I use custom data format?

Closed this issue · 3 comments

As I understand from jsTree tutorial native plugin does support this feature. I just provide callback function which called on each node and I can format it as desired. Can I do same with angularized plugin?

For example my data node is following:

       {
            "groupId": 21,
            "parentGroupId": 0,
            "groupName": "Network",
            "ownerId": "123456"
        }

So, instead of id I want to use groupId, instead of parent I want to use parentGroupId and instead of text I want to use groupName.

Thank you in advance.

I am not aware of this plugin... just try :)

you can use core.data jsTree config.

$('#your-tree').jstree({
    core : {
        data : function (node, cb) {
            $.ajax({ url : ... }).done(function (data) {
                cb([{ "id" : data.id, "text" : data.name }])
            });
        }, ...

similar question posted here

@smohammedyasin , thank you. Will try it next time or perhaps it will be useful for someone else. I just make function which transform all my object accordingly to jsTree requirement every time when I need, works perfect.