1

ext.js[4.1..1aGPL]のcellclickでitemclickイベントを発生させることができません。私のapp.jsは次のようになります:

Ext.application({
    name: 'HelloExt',
    launch: function() {
 var k =  Ext.create('Ext.panel.Panel', {
        title: 'Tic Tac Toe',
        width: 300,
        height: 300,
    layout: {
            type: 'table',
            // The total column count must be specified here
            columns: 3
        },
        defaults: {
            // applied to each contained panel
            bodyStyle:'padding:20px'
        }
    ,
        items: [{
            html: '',
        },{
            html: '',
        },{
            html: ''
        },{
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
        ],
        renderTo: Ext.getBody(),
    listeners :
    {
        itemclick: function(dv, record, item, index, e) {
           alert(record);
       }
    }
   });
}
});

誰でも助けてください。

ありがとう

4

1 に答える 1

0

このリスナーはパネルには存在しません。少なくともビューが必要になります。以下の例は、「フィールド」ごとにクリックイベントをキャッチします。

Ext.application({
    name: 'HelloExt',
    launch: function() {
 var k =  Ext.create('Ext.panel.Panel', {
        title: 'Tic Tac Toe',
        width: 300,
        height: 300,
    layout: {
            type: 'table',
            // The total column count must be specified here
            columns: 3
        },
        defaults: {
            // applied to each contained panel
            bodyStyle:'padding:20px',
            listeners: {
                afterRender: function(p) {
                    p.body.on('click', function() { alert(p.id) });
                }
            }
        }
    ,
        items: [{
            html: ''
        },{
            html: '',
        },{
            html: ''
        },{
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
    {
            html: ''
        },
        ],
        renderTo: Ext.getBody()
   });
}
});
于 2012-11-20T11:29:48.247 に答える