javascriptlistdom-eventssencha-touch-2

Sencha Touch 2 list new page list tap response


I am learning Sencha Touch 2 and I have a list similar to this presidents list. Tapping the arrow loads a new page with a back button.

With my list, when I tap on the arrow I would also like to load a new page.

I borrowed some code from the presidents list which responds to a tap on an arrow and loads a new page in response. The code is as follows:

console.log('tap response! ');
    this.getMain().push({
        xtype: 'article',
        title: 'testing title', //record.term(),
    });

The console.log responds so I know my function is responding to tap events on my list. However, the rest of the code fails with the following error:

Uncaught TypeError: Object [object Object] has no method 'push'

The this.getMain() function returns a reference to my main page which extends Ext.tab.Panel (I suspect that's my problem).


Solution

  • push() is a method on Ext.navigation.View. If you have a navigationview as what is inside of your tabpanel, you will need to get that view instead and call push() on it rather than the tabpanel.