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
.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