2013-03-13 90 views
0

我正在創建下面的表單,但出於某種原因,選擇按鈕處理程序不會執行 。其他一切正常工作(將數據加載到網格中)。 有什麼我失蹤了嗎?ExtJS按鈕不執行處理程序

Ext.Loader.setConfig({enabled:true}); 

Ext.define('Project', { 
    extend: 'Ext.data.Model', 
    fields: ['PID', 'ProjectName'] 
}); 

var projectsStore = Ext.create('Ext.data.Store', 
{ 
    model: 'Project', 
    autoLoad: true, 
    proxy:{ 
     type: 'ajax', 
     url : 'projects.php?action=read', 
     reader:{ type:'json', root:'projects', successProperty:'success' } } 
}); 

Ext.onReady(
    function() 
    { 
     var simple = Ext.create('Ext.form.Panel', { 
     url:'projects.php?action=select', 
     frame:true, 
     title: 'Projects', 
     bodyStyle:'padding:5px 5px 0', 
     width: 350, 
     fieldDefaults: { 
      msgTarget: 'side', 
      labelWidth: 75 
     }, 
     defaultType: 'textfield', 
     defaults: { 
      anchor: '100%' 
     }, 

     items: [{ 
      columnWidth: 0.60, 
     xtype: 'gridpanel', 
     store: projectsStore, 
     height: 400, 
     title:'General', 
     columns: [ 
     {header: 'Id', dataIndex: 'PID', flex: 1}, 
     {header: 'Project Name', dataIndex: 'ProjectName', flex: 1}, 
     ] 
     }], 

     buttons: [{ 
      text: 'Select', 
      handler: function() { 
       Ext.Msg.alert('Selecting', action.result.msg);    
      } 
     }] 
    }); 

    simple.render('proj-form'); 

     projectsStore.load(); 
    } 
); 

回答

1

您的代碼在運行處理程序時崩潰,因爲action.result.msg不存在。

你可以看看Firebug/Chrome開發工具,它會告訴你的問題。

+0

我沒有看到螢火蟲的錯誤。你看什麼標籤? – 2013-03-13 03:00:12