admin管理员组

文章数量:1313347

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?

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?

Share Improve this question asked Jul 12, 2012 at 9:14 Kliver MaxKliver Max 5,29924 gold badges101 silver badges157 bronze badges 2
  • Accept race give me more answers on my questions? – Kliver Max Commented Jul 12, 2012 at 10:31
  • Im really try to accept answers. But usually noone aswer me or i find answer by myself. its sad. – Kliver Max Commented Jul 12, 2012 at 11:06
Add a ment  | 

1 Answer 1

Reset to default 7

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!!!!!");
            }
        }]
}

本文标签: javascriptAdd buttons in grid column ExtJsStack Overflow