Search code examples
extjstreepanel

ExtJS 4.0 Find data in model and treepanel


With the following Json I populate a treepanel:

[{"text":"Item 1}", "expanded":true, "cls":"folder", "children":
    [{"text":"Item 1.1", "leaf":true, "foo", "bar"},
    ...
...

When the user selects Item 1.1 in the tree I'm able to find the selected Item:

onTreepanelSelectionChange: function(tablepanel, selections, options) {
    var selItem = selections[0].data.text;

So I have access to properties like text, expanded, ... But I can't find a way to access the value of foo. I think my problem is caused by the fact that I find the selected item via the treepanel and that the value of foo is only available in the store.


Solution

  • Add a foo property to your model.