Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get rid of recursive AJAX requests for a childless node?

Problem:

According to the author, jsTree Documentation:

When opening a closed node (that has no loaded children) an AJAX request is made.

How do I configure jsTree to get rid of these AJAX data requests made for each empty/childless node? I want my empty nodes remain empty (or childless)!


Given (simplified):

JSON data container (data.json)

{
    "data" : "Root node with no children",
    "children" : []
}

jsTree configuration

{
    "json_data" : {
        "ajax" : {
            "url"        : "data.json",
            "type"       : "GET",
            "dataType"   : "json",
            "dataFilter" : function (data, type) {
                //some filtering function
            }
        }
    },
    "plugin" : ["json_data"]
}

like image 319
John Doe Avatar asked May 23 '11 10:05

John Doe


1 Answers

Mark the state of the leaf node as "leaf". That should fix it.

like image 139
Sree Kollu Avatar answered Oct 04 '22 21:10

Sree Kollu