PDA

View Full Version : NestedList Access to Parent Items



graham_alton
8 Oct 2010, 12:42 AM
I'm using a nestedlist and want to access the records of parent nodes in the tree. I can't find a sensible way to do this so thought I'd ask here...

This is what I have to fire events from the nestedlist onItemTap so far:


onmainMenuTap : function(subList, subIdx, el, event) {
var record = subList.getStore().getAt(subIdx);

if (!record.node.childNodes.length) {
this.mainMenu.hide();
this.fireEvent('navigate', record, subIdx);
}
}What I want to add to the navigate event is the title of the upper most parent entry. So for example, if I have the menu structure something like

A -> AA
A -> AB
B -> BA
B -> BB -> B1

If the user selects A -> AB I would like to send back "A", if the user selects B -> BA I would like to send back "B" and if the user select B -> BB -> B1 I would like to send back "B".

Thanks!

graham_alton
8 Oct 2010, 8:16 AM
Note to self, on discovering Ext.data.Node has parentNode it seems that the store getById function isn't working correctly in 0.96 which is stopping me writing something to recurse back up the tree by ID, see http://www.sencha.com/forum/showthread.php?111345-OPEN-383-Store-in-0.96-not-working-properly