Search code examples
sencha-architectsencha-touch-2.1

Creating 2 buttons on Same Screen Sencha Architect 2


I'm following this tutorial to create a Sencha Touch Application,

I want to create 2 buttons on the same screen and each button redirect to another page when clicked, on the tutorial it use Form panel and only one button to redirect to another page, but if I link 2 Form Panels to the Navigator View, it only appear one form panel, I want to know a way to add 2 buttons on the same screen and call one userAlias for each button to redirect to the another page.

What I do ? Add 2 buttons on the same FormPanel ? If yes, how I call one diferent page for each button, because I use only one userAlias on the form panel with this function:

button.up('navigationview').push({
     xtype: 'step3',
     title: 'Step 3'
 });

Thanks for the help


Solution

  • use two different handlers for the buttons.

    Example :: Button 1 ::

    {
      xtype : 'button',
      text : 'button 1',
      handler : function(){
        alert('do something');
        this.up('navigationview').push({ . . . . });
      }
    }
    

    Example :: Button 2 ::

    {
      xtype : 'button',
      text : 'button 2',
      handler : function(){
        alert('do something else');
        this.up('navigationview').push({ . . . . });
      }
    }