How to get the text of the currently selected node in jstree?

It seems like it should be easy to do, but the jstree method "data.rslt.obj.text ()" likes to return the text of the current node, as well as all its children. I figured out how to get the current name of the node with the renamed node (new_name), but how can I get the text ONLY of the current node when I just select it? In addition, I would appreciate understanding how to find all of these methods and properties in jstree using chrome or firebug. Where can I look in the list of elements that appear, for example, when selecting "data.rslt". Thank!

 $("#RequirementsTree")
    .bind("select_node.jstree", function(event, data) {
            if(is_requirement_node(data))
            {
                var ReqCheck = data.rslt.obj.attr("name");

                @* This is a REQUIREMENT *@
                if(ReqCheck == "requirement")
                {
                    $("#RMSDoc_RequirementFlag").val("EDIT");
                    $("#RMSDoc_RBSRequirement_RequirementsId").val(data.rslt.obj.attr("id").substring(4));
                    $("#RMSDoc.RBSRequirement.RequirementsId").val(data.rslt.obj.attr("id").substring(4));
                    $("#RMSDoc_RBSRequirement_RequirementsText").val($.trim(data.rslt.obj.text()));
                    $("#RMSDoc_TreeBranch_Text").val("");
                    $("#HierarchyText").hide();
                    $("#RMSDoc_TreeBranch_Text").hide();
                    $("#ExistingTreeSubmit").val("@Model.RMSDoc.RMSEditReqButton.ConfigurableLabelDesc");

                }
                else {
                    alert("Requirement node select error");
                }
            }
            @* This is a TREE BRANCH *@
            else
            {
                debugger;
                $("#RMSDoc_RequirementFlag").val("ADD");
                $("#HierarchyText").show();
                $("#RMSDoc_TreeBranch_Text").show();
                $("#RMSDoc_TreeBranch_Text").val($.trim(data.rslt.obj.text()));
                $("#RMSDoc_TreeBranch_id").val(data.rslt.obj.attr("id").substring(4));
                $("#RMSDoc_RBSRequirement_RequirementsText").val("");
                $("#ExistingTreeSubmit").val("@Model.RMSDoc.RMSCreateReqButton.ConfigurableLabelDesc");
            }
     })
    .bind("create.jstree", function(e, data) {
+5
source share
1 answer

jstree , length .

if ($('.jstree-checked').length == 1) {
    alert( 'Checked Item -: ' + $('.jstree-checked').text() );
}

, .

if ($('.jstree-clicked').length == 1) {
    alert( 'Selected Item -: ' + $('.jstree-clicked').text() );
}

jstree, Firebug jstree.js. , .bind .js . , , .

+9

All Articles