0

I have started to use ExtJs 4. I have grid with buttons in one column. I can't manage to get button click for button in selected cell by controller. I would like to get click and then details for row in order to open extra window with details.

Code:

Ext.define('AP.controller.List', {
    extend : 'Ext.app.Controller',
    stores : ['Users'],
    models : ['User'],
    views : [ 'List', 'Details' ],

    init : function() {
        console.log("users");
        this.control({
            'viewport > listPanel > userlist' : { 
                itemdblclick : this.userDbCClicked
            },
            'viewport > listPanel button AND WHAT MORE ?' : {
                click : this.statusButtonClicked
            }       
        });
    },

    userDbCClicked : function(grid, record) {
        console.log("user db clicked");

    },


    statusButtonClicked : function(grid, record) {
          // Here I would like to get row details after click on button in column
        console.log("statusButtonClicked clicked ");
    }

});

What should be put instead this code:

        'viewport > listPanel button AND WHAT MORE?' : {
            click : this.statusButtonClicked
        }

Of course it dosen't work. How to get row by click on button in cell ?

Thanks in advance for help.

ExtJs is very powerfull framework but first steps are realy difficulted sometimes.

Bogus

4

2 回答 2

0

克里斯说的是真的。您也可以在按钮上设置名称属性,这只是查询组件的一种方式。在这里解释:

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.ComponentQuery

{ xtype:'按钮',名称:'状态按钮'}

'视口> listPanel > 按钮[名称=状态按钮]'

这是 Ext.Apps 的一个很好的入门指南:

http://docs.sencha.com/ext-js/4-1/#!/guide/mvc_pt1 和另一个: http ://docs.sencha.com/ext-js/4-1/#!/guide /application_architecture

于 2012-08-02T15:00:33.330 回答
0

在您的按钮配置中放置一个操作:'statusbutton'

然后使用'viewport > listPanel > button[action=statusbutton]'

于 2012-08-02T13:49:10.457 回答