0

尝试将按钮推送到不同的视图“新配置文件”和“配置文件页面”(第二个视图) 当然我会进行身份验证,但是只是在实现控制器和服务器端之前尝试让视图正确。

有以下错误:

  1. 未捕获的 ReferenceError:未定义视图 Main.js:116
  2. 未捕获的 ReferenceError:未定义视图 Main.js:126

谷歌只带回“未定义 ext”的响应。

原谅令人震惊的编码,因为这是我的第一个学校作业应用程序(如果可能,请提供反馈如何改进它)我知道需要定义视图,但是在 Sencha Touch 的 API 中是我获得信息的地方。

谢谢你的时间。

var pageFilterGame = {
    xtype: 'panel',  
    title: 'Filter Games',            
    items: [
        {
            xtype: 'fieldset',
            title: 'Filter games to find the perfect one',
            instructions: 'Please fill in atleast one field to start.',
            items: [
                {  
                    xtype: 'selectfield',
                    label: 'What enviroment will this game be played in',                    
                    options: [
                        { text: 'Outside on Grass', value: 'grass' },
                        { text: 'Outside on Concrete', value: 'concrete' },
                        { text: 'Inside', value: 'inside' }
                        ]        
                },
                {
                    xtype: 'selectfield',
                    name: 'equipment',                                
                    label: 'What equipment do you have',
                    options: [{text: 'DB form'}]
                },
                {
                    xtype: 'numberfield',
                    name : 'Player Numbers',
                    label: 'How many players do you have',
                    minValue: 2,
                    maxValue: 50
                },
                {
                    xtype: 'numberfield',
                    name: 'avgname',
                    label: 'Average age of players',
                    minValue: 2,
                    maxValue: 99
                },
                {
                    xtype: 'selectfield',
                    label: 'Sort result by:',
                    options: [
                        { text: 'Highest Rated', value: 'rated' },
                        { text: 'Equipment', value: 'equipment' },
                        { text: 'Alphabetically', value: 'alpha' }
                        ]
                },
            ],
        },                            
        {
            xtype: 'button',
            ui: 'action',
            text: 'Filter Games',
            action: '',
            maxWidth: '150px'                        
        }
    ]
};

var pageSearch = {
    xtype: 'panel',       
    title: 'Search',
    items: [
        {
            xtype: 'fieldset',
            title: 'Search',
            items: [
                {
                    xtype: 'searchfield',
                    label: 'Search',
                    name: 'search'
                }
            ]
        },
        {
            xtype: 'button',
            ui: 'action',
            text: 'Search',
            action: '',
            maxWidth: '100px'                   
        }
    ]
};

var pageProfileLogin = {
    xtype: 'panel',
    title: 'My Profile',
    items: [
        {
            xtype: 'fieldset',
            title: 'Please login to access your profile',                    
            items: [
                {
                    xtype: 'textfield',
                    name : 'username',
                    label: 'Username'                                
                },
                {
                    xtype: 'passwordfield',
                    name: 'password',                                
                    label: 'Password',
                    clearIcon: false                         
                }
            ]
        },  
        {
            xtype: 'toolbar',
            docked: 'bottom',
            items: [
                {
                    text: 'Login',
                    ui: 'confirm',
                    handler: function() { 
                    view.push({                            
                        title: 'Second View',
                        padding: 10,
                        })},
                },                      
                {
                    xtype: 'button',
                    ui: 'action',
                    text: 'Create New',                         
                    handler: function() {                          
                    view.push({
                        title: 'New Profile',
                        items: [
                            {
                                xtype: 'fieldset',
                                title: 'Please fill in the form to create your profile',                    
                                items: [
                                    {
                                        xtype: 'textfield',
                                        name : 'username',
                                        label: 'Username'                                
                                    },
                                    {
                                        xtype: 'passwordfield',
                                        name: 'password',                                
                                        label: 'Password',
                                        clearIcon: false                         
                                    },
                                    {
                                        xtype: 'textfield',
                                        name : 'name',
                                        label: 'Name'                                
                                    },
                                ],
                            },
                            {                               
                                xtype: 'toolbar',
                                docked: 'bottom',
                                items: [
                                    {
                                        text: 'Login',
                                        ui: 'confirm',                                         
                                    },
                                ]
                            }
                        ]        
                    });
                    }                           
                },

            ]
        },
    ]}

var viewTabConfig = {
    xtype: 'tabpanel', 
    styleHtmlContent: true,
    title: 'Get Creative!',
    items: [pageFilterGame, pageSearch, pageProfileLogin]
};

var viewDef = {
    //
    // Another new UI element introduced. This UI element allows one to add multiple panels in a 'stacked' like operation. A
    // new panel when pushed into the NavigationView will be displayed along with a back button. When the back button is tapped,
    // the visible view is 'popped' and the parent view gets displayed again. See demo in the lecture recording.
    //
    extend: 'Ext.NavigationView',
    id: 'navView',
    requires: [
        'Ext.TitleBar',
        'Ext.Video',
        'Ext.field.Password',
        'Ext.field.Select',
        'Ext.field.Number',
        'Ext.field.Search',
        'Ext.form.FieldSet',
        'Ext.tab.Panel',    
        'Ext.data.Store',
        'Ext.data.reader.Xml'
    ],
    config: {
        fullscreen: true, 
        items: [viewTabConfig]
    }   
};

Ext.define("a2.view.Main", viewDef);
4

1 回答 1

0

我不得不向 app.js 文件添加额外的模型和视图,它运行良好。

于 2012-09-25T10:41:22.767 回答