Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 如何关联/检索Ext.NET中每个TreePanel节点的自定义数据_Extjs_Ext.net_Treepanel - Fatal编程技术网

Extjs 如何关联/检索Ext.NET中每个TreePanel节点的自定义数据

Extjs 如何关联/检索Ext.NET中每个TreePanel节点的自定义数据,extjs,ext.net,treepanel,Extjs,Ext.net,Treepanel,我想关联树面板中每个节点的自定义数据。然后我将在客户端使用它 服务器端看起来像: Ext.Net.Node root = new Node {Text = "Dummy Form"}; root.AttributesObject = new { nodeType = "Form" }; Ext.Net.Node section01 = new Node { Text = "Section 01" }; section01.Attr

我想关联树面板中每个节点的自定义数据。然后我将在客户端使用它

服务器端看起来像:

        Ext.Net.Node root = new Node {Text = "Dummy Form"};
        root.AttributesObject = new { nodeType = "Form" };

        Ext.Net.Node section01 = new Node { Text = "Section 01" };
        section01.AttributesObject = new { nodeType = "Section" };
    .Listeners(l =>
    {
       l.ItemClick.Handler = "myClickHandler(item,record,node,index,e)";
    }
如何在客户端访问此属性对象?

客户端看起来像:

        Ext.Net.Node root = new Node {Text = "Dummy Form"};
        root.AttributesObject = new { nodeType = "Form" };

        Ext.Net.Node section01 = new Node { Text = "Section 01" };
        section01.AttributesObject = new { nodeType = "Section" };
    .Listeners(l =>
    {
       l.ItemClick.Handler = "myClickHandler(item,record,node,index,e)";
    }
我尝试了以下方法:

  • item.nodeType
  • record.nodeType
  • node.nodeType
  • record.data.nodeType
以上这些都不适用于我,它们都返回“未定义”。记录。raw[attributeFieldName]可用于访问客户端数据

对于定义如下的单击处理程序:

.Listeners(l =>
    {
       l.ItemClick.Handler = "myClickHandler(item,record,node,index,e)";
    }
在服务器端设置属性:

section01.AttributesObject = new { nodeType = "Section" };
访问客户端中的自定义集属性:

function myClickHandler(item, record, node, index, e) {

    var nodeType = record.raw.nodeType;
    console.log(nodeType); //prints "Section"

}

尝试在控制台中回显根元素。在那里,您可以检查它并得出正确的方法。我猜应该是node[index].nodeType