簡體   English   中英

ExtJS按鈕不執行處理程序

[英]ExtJS button does not execute handler

我正在下面創建表單,但是由於某些原因,選擇按鈕處理程序未執行。 其他一切工作正常(將數據加載到網格中)。 有什么我想念的嗎?

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();   
    }
);

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

您可以查看Firebug / Chrome開發工具,它會向您顯示問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM