2012-09-14 47 views
0

嘗試將按鈕推到不同的位置視圖'新配置文件'和'配置文件頁面'(第二視圖)當然,我會進行身份驗證,但只是嘗試在實現控制器和服務器端之前獲取正確的視圖。Sencha Touch 2「視圖未定義」控制檯錯誤

具有以下錯誤:

  1. 未捕獲的ReferenceError:鑑於沒有定義Main.js:116
  2. 未捕獲的ReferenceError:鑑於沒有定義Main.js:126

谷歌只帶回「分機未定義」的迴應。

原諒令人震驚的編碼,因爲這是我的第一個應用程序,我的學校作業(請給出反饋如何改善這個如果可能)我明白,該視圖需要定義,但在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); 

回答

0

我不得不添加額外的模型和視圖到app.js文件,它工作正常。