【问题标题】:How to get the New Name of node changed in JSTree "rename"如何在 JSTree“重命名”中更改节点的新名称
【发布时间】:2012-06-04 09:03:50
【问题描述】:

我正在尝试使用以下代码重命名节点,我需要将节点的 ID 和新名称传递给 server.aspx

如何获取节点的新名称

如何将这两个值传递给 server.aspx 页面

谢谢

   .bind("rename.jstree", function (e, data) {
            data.rslt.obj.each(function () {
                $.ajax({
                    async: false,
                    type: 'POST',
                    url: "./ajax/server.aspx",
                    data: 
                    {
                        "operation": "rename_node",
                        "id": this.id 
                    },
                    success: function (r) {
                        if (r == "-1") {
                            $.jstree.rollback(data.rlbk);
                        }
                        else {
                            $(data.rslt.oc).attr("id", "node_" + r.id);
                            if (data.rslt.cy && $(data.rslt.oc).children("UL").length) {
                                data.inst.refresh(data.inst._get_parent(data.rslt.oc));
                            }
                        }
                    }       
                });
            });
        })

【问题讨论】:

    标签: c# javascript jstree


    【解决方案1】:
      .bind("rename.jstree", function (e, data) {
            data.rslt.obj.each(function () {
                $.ajax({
                    async: false,
                    type: 'GET',
                    url: "./ajax/server.aspx",
                    data: 
                    {
                        "operation": "rename",
                        "id": this.id,
                        "new_name" : data.rslt.new_name 
                    },
                    success: function (r) {
                        if (r == "-1") {
                            $.jstree.rollback(data.rlbk);
                        }
                        else {
                            $(data.rslt.oc).attr("id", "node_" + r.id);
                            if (data.rslt.cy && $(data.rslt.oc).children("UL").length) {
                                data.inst.refresh(data.inst._get_parent(data.rslt.oc));
                            }
                        }
                    }       
                });
            });
    
        })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-26
      • 2011-08-10
      • 1970-01-01
      • 1970-01-01
      • 2012-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多