How to update jstree node values without reload

前端 未结 6 2077
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 07:11

I have a jstree that I created with the following code:

$(\'#mytree\').jstree({\"core\": { \"data\" : value
                             , \"themes\" : { \"dots\         


        
6条回答
  •  日久生厌
    2021-02-07 07:47

    What you need is not refresh() but redraw() thus the code is

    $('#mytree').jstree(true).settings.core.data = new_data;
    $('#mytree').jstree(true).redraw(true);
    

    You can find the functions in the jstree API.

    As per zmirc suggestion, in v3.1 use:

    $('#mytree').jstree(true).settings.core.data = new_data;
    $('#mytree').jstree(true).refresh();
    

提交回复
热议问题