I want to associate custom data for each node in my TreePanel. Then i will use it in client-side.
Server side looks like:
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" };
How can i access this AttributesObject in client-side?
Client side looks like:
.Listeners(l =>
{
l.ItemClick.Handler = "myClickHandler(item,record,node,index,e)";
}
I tried the followings:
None of above worked for me, each of them returns "undefined".
record.raw.[attributeFieldName] can be used for accessing data client-side.
For a click handler defined as below:
.Listeners(l =>
{
l.ItemClick.Handler = "myClickHandler(item,record,node,index,e)";
}
Set attribute in server-side:
section01.AttributesObject = new { nodeType = "Section" };
Access custom set attribute in client-side:
function myClickHandler(item, record, node, index, e) {
var nodeType = record.raw.nodeType;
console.log(nodeType); //prints "Section"
}