PDA

View Full Version : Manually 'tap' an item in a (nested)list?



Graaf
3 Jan 2011, 2:39 PM
Is there a way to manually 'tap' an item in an (nested)list ?

Example:

I have a button in the dashboard of my webapp, and I want that button to open the 2nd tab and go to the 1st item of the (nested)list item and show the child items.

Graaf
7 Jan 2011, 12:10 PM
What I mean is .. programmatically 'click' on one of the items on the first level so childs wil be shown.

Graaf
23 Jan 2011, 4:42 AM
anyone?

tomalex0
23 Jan 2011, 7:23 AM
Below code will probably helps to select nestedlist items.




xtype:'button',
text :'Nested',
handler:function(btn,e){
var activelist= nestedPanel.getActiveItem();
var listselectednode = activelist.getNode(1);
nestedPanel.fireEvent('itemtap',activelist,1,listselectednode ,e);
}


and if u want to dynamically select tab , you can use fireEvent('change',) for Tabbar

Hope this helps

Graaf
24 Jan 2011, 12:42 PM
A little ...



Ext.get('button-id').addListener('tap', function(e) {
Ext.getCmp('viewport').setActiveItem(1);
var activeList = Ext.getCmp('listComponent').getActiveItem();
var listSelectedNode = activeList.getNode(0);
Ext.getCmp('listComponent').fireEvent('itemtap', activeList, 0, listSelectedNode, e);

});

this is what i do. . 'buttns' on home screen are html "buttons" so that's why I'm doing the get('..')

But this doesn't work correctly .. I need some nestedlist reset ( without reloading all data ) before going there because it remembers wrong.
When I tap the button, go back home and tap again .. the back button in the nestedlist goes back to itself one time.
And sometimes I see a backbutton on the nestedlist root ... weirdness

tomalex0
24 Jan 2011, 8:04 PM
Go through this thread

http://www.sencha.com/forum/showthread.php?120907-Nested-List-Index-Issue-Question&p=560538#post560538

Graaf
25 Jan 2011, 12:46 AM
Ok!

Thank you so much! This solved my problem. :)

Jamesaya
16 Jun 2012, 12:07 AM
getNode() has been removed in ST2.Is there any alternative methods?