0

I don't see the alert in this code. It is possibly a typo because i traced the code as it was executing and I receive the correct "nodeInfo" the alert just doesn't come up.

    function loadTree(jsonData){
        var treeInfo = attachTree(stageTreeData(getJson(jsonData)));
        $("#apple_tree").jstree({                           
        "json_data": {"data": treeInfo},    
        "plugins" : [ "themes", "json_data", "ui" ]
        }).bind("select_node.jstree", function (event, data) {
           // `data.rslt.obj` is the jquery extended node that was clicked
           var nodeInfo = data.rslt.obj.attr("id");
           alert(nodeInfo);
       });
    }

Thanks for any and all help!!

EDIT #1 Changed the code structure:

function loadTree(jsonData){
    var treeInfo = attachTree(stageTreeData(getJson(jsonData)));
    $("#apple_tree").jstree({                           
        "json_data": {"data": treeInfo},    
        "plugins" : [ "themes", "json_data", "ui" ]
    });
    $("#apple_tree").bind("select_node.jstree", function (event, data) {
        // `data.rslt.obj` is the jquery extended node that was clicked
        var nodeInfo = data.rslt.obj.attr("id");
        alert(nodeInfo);
    });
}

Still no luck on the alert() showing up.

4

0 回答 0