0

这是我在sencha中的代码。我想从主视图推送一个新视图,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新手。请帮我解决

4

1 回答 1

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

于 2013-08-14T10:52:44.853 回答