PDA

View Full Version : How can I process ExtJS 4.2.1 tree item text before it is rendered?



xjscrafter
19 Jun 2014, 2:08 PM
I need to swap the localization IDs with their actual string values (for the current locale) in tree data.

So if there were an event such as renderTreeItem, in its handler I might do this, where StringMessage.getResource(id) returns the localized string for the id:


onRenderTreeItem(text) {
return StringMessage.getResource(text)
}



root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "algebra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}

xjscrafter
19 Jun 2014, 2:42 PM
SOLVED
I use a convert function in the tree model.