Search code examples
javascriptjstree

How to update data attribute in JSTREE?


I have some data for jstree.

             { "text": "some job name", 
                     "type": "job",
                            "id": 1200, 
                            "price": "0.00", 
                            "jobname": "somename", 
                            "time": "0.000", 
                            "jobtype": "12", 
                            "deletable":1, 
                            "archive":1,
                            "icon": "fa fa-angle-right   ",
                            "group": "2075"
                            }

I can change name, id. How I can change on-fly other attributes? 'archive', 'deletable'?

$($('#groups').jstree().get_selected(true)).attr('archive', 2);

Not working.

$($('#groups').jstree().get_selected(true)).attr('data-archive', 2);

Not working too


Solution

  • okey this is worked for me

    $('#tree').jstree().get_selected(true)[0]['original'].archive = value