Kliver Max
Kliver Max

Reputation: 5299

Add buttons in grid column. ExtJs

I want to add buttons in one of columns in the grid. I try this code

listeners: {
render: {
    fn: function(kad_tab){
        var view = kad_tab.getView();
        for (var i = 0; i < store.getCount(); i++) {
            var cell = Ext.fly(view.getCell(i, 2));
            new Ext.Button({
                handler: function(){
                    alert('Suppression')
                },
                renderTo: cell.child(".btn"),
                text: 'Supprimer'
            });
        }
    },
   // delay: 200
}

}

{header: "", width: 70, dataIndex: '', renderer: function(){ return '<div class="btn" style="height: 11px; width: 60px"></div>';}}

But firebug says that he see error here Ext.fly(this.getRow(c)) is null. if i use delay: 200. There is no errors in firebug but dont see a buttons in column.

What im doing wrong?

Upvotes: 4

Views: 8963

Answers (1)

Kliver Max
Kliver Max

Reputation: 5299

I found a simple way...

{
        xtype: 'actioncolumn',
        width: 50,
        items: [{
            icon   : url_servlet+'externals/gxp/src/theme/img/pencil.png', 
            tooltip: 'Button click',
            handler: function(grid, rowIndex, colIndex) {
                alert("DAMACIA!!!!!");
            }
        }]
}

Upvotes: 7

Related Questions