jsTree更改状态节点

时间:2019-03-20 08:37:59

标签: c# jquery ajax jstree jquery-events

要更改节点的状态,我进行了以下更改

"ChangeStatus": {
                "separator_before": false,
                "separator_after": false,
                "_disabled": false, //(this.check("changeStatus_node", data.reference, this.get_parent(data.reference), "")),
                "label": "ChangeStatus",
                /*!
                "shortcut"          : 113,
                "shortcut_label"    : 'F2',
                "icon"              : "glyphicon glyphicon-leaf",
                */
                "action": function (data) {
                    var inst = $.jstree.reference(data.reference),
                        obj = inst.get_node(data.reference);
                    var node_status;
                    if (inst.is_disabled(obj)) {
                        node_status = 'enable';
                    }
                    else {
                        node_status = 'disable';
                    }
                    inst.changeStatus_node(obj, node_status);
                }
            },
/**
     * set the text value of a node status
     * @name changeStatus_node(obj, changeTo)
     * @param  {mixed} obj the node
     * @param  {String} changeTo the new status
     * @return {Boolean}
     * @trigger changeStatus_node.jstree
     */

    changeStatus_node: function (obj, changeTo) {

        if (changeTo == 'disable') {
            this.disable_node(obj);
        }
            else {
            this.enable_node(obj);
        }
            var childrens = this.get_children_dom(obj);
        for (var i = 0; i < childrens.length; i++) {
            if (childrens.length > 0) {
                    this.changeStatus_node(childrens[i], changeTo);
                }
            }   


        /**
         * triggered when a node is changeStatus
         * @event
         * @name changeStatus_node.jstree
         * @param {Object} node
         * @param {String} changeTo the new status

         */
        this.trigger('changeStatus_node', { "node": obj, "changeTo": changeTo });
        return true;
    },

一切正常 直到到达这一行

this.trigger('changeStatus_node',{“ node”:obj,“ changeTo”:changeTo});

这会导致代码执行不完整。 请引导我。

0 个答案:

没有答案