View Full Version : How to add action to back-button in NestedList?

25 Mar 2011, 4:13 AM
I want to ask if I can add a custom action to back button in nested list.
I have eq. method:

var showDefaultMap = function(btn, event) {

And I have also a NestedList. Can I add this defaultMap function to the back button in NestedList??

Or can I set for each level of NestedList a different function?

And my last question :) Is there a function that returns NestedList to the root?

Thanks a lot guys :) And happy Sencha Touch developing.

25 Mar 2011, 8:14 AM
The NestedList Control is nothing more than a card layout with toolbars and lists as the the cards. So, you can add listeners to the NestedList and perform actions as needed. You could probably use the itemtap or beforecardswitch event to stop the current event and perform your own actions.

So something like this:

xtype: 'nestedlist',
listeners: {
itemTap: function(list, index, item, e ) {
// Probably best to use this event to stop the current event and do
// your own custom code here, like check the event source to see if the
// back button was pressed, then go somewhere else.
beforecardswitch: function (cont, newCard, oldCard, index, anim) {
// Could possibly use this event as well.

Hopefully that points you in somewhat of a better direction.