繁体   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