如何在推送上设置另一个视图

时间:2013-08-14 09:58:32

标签: navigation sencha-touch-2 viewport

这里我的代码在sencha.I想从家庭视图推送一个新视图,html正在工作,但如何添加其他视图而不是html。

Ext.application({
launch: function () {
                     var signinformBase = {
                     standardSubmit : false,
                     items: [
                     {
                     xtype: 'fieldset',
                     scope:this,
                     defaults: {
                     required: true,
                     labelAlign: 'left',
                     labelWidth: '37%'
                     },
                    title: 'Enter your wish',
                    items: [{
                            xtype: 'textfield',
                            name : 'emailid',
                            label: 'Item Name',
                            useClearIcon: true
                            },{
                            xtype: 'textfield',
                            name : 'password',
                            label: 'Description',
                            useClearIcon: true
                            },{
                            xtype: 'textfield',
                            name : 'Price',
                            label: 'Price',
                            useClearIcon: true
                            },
                            {
                            xtype:  'button',
                            text:   'Add Image',
                            ui:     'round',
                            handler: function()
                            {

                            }
                            },{
                            xtype:  'button',
                            text:   'Add Location',
                            ui:     'round',
                            handler: function()

                            {
                            viewport.setActiveItem(0, {type:'fade', direction:'left'});
                            viewport.setActiveItem({
                                                   title: 'Second',
                                                   html: 'Second view!'
                                                   });
                            }
                            }
                            ,{
                            xtype: 'textfield',
                            name : 'password',
                            label: 'Category',
                            useClearIcon: true
                            },{
                            xtype: 'textfield',
                            name : 'password',
                            label: 'Location',
                            useClearIcon: true
                            }],
                    },
                    {
                    xtype:  'button',
                    text:   'Done',
                    ui:     'round',
                    handler: function()

                    {

                    view.push({
                                   title: 'Second',
                                   html: '<font ><h3 style="font-weight:bold"><b>Congratulations!</font></h3><div  align="left"  style="border: 0px black solid; padding-left:10px;"><br><font>Congratulations! You have successfully signed up for a account. A confirmation email will be sent to your email.</font><br><br></div><br><br><p align="center"><button type="button" onClick="javascript:gomyaccount()" class="button" ><font size="3" face="arial">Next</font></button><p>'
                              });
                    },

                    ]
            };
                  var view = Ext.create('Ext.NavigationView', {
        fullscreen: true,
                          items: [
                                  {
                                  title: 'Home',
                                  items: [signinformBase]
                                  }]
    });
} // launch
});

viewport.setActiveItem(0,{type:'fade',direction:'left'});也不起作用,我对sencha.please的新手帮我解决了

1 个答案:

答案 0 :(得分:1)

在您的示例中,视口未定义变量。您可以改用视图。

{
       xtype:  'button',
       text:   'Add Location',
       ui:     'round',
        handler: function(){
             view.setActiveItem(0, {type:'fade', direction:'left'});
              view.setActiveItem({
                 title: 'Second',
                 html: 'Second view!'
             });
        }
    }

源代码http://www.senchafiddle.com/#t26Yx