anupkumar
anupkumar

Reputation: 357

Passing parameter to window panel from grid panel in EXTJS4

{
    icon: 'images/delete.png', 
    tooltip: 'Edit',

    handler: function(grid, rowIndex, colIndex) {
            var edit = Ext.create('AM.view.user.Uploadfile').show();
            //here I want to pass parameters to get in window panel     
    }
}

The code that I have written and want the parameter to be passed like the row id where the icon is clicked on window panel.

Upvotes: 2

Views: 3563

Answers (2)

A1rPun
A1rPun

Reputation: 16837

It is a button on a actioncolumn. To pass the Id to a window you can retrieve the row data by getting it from the record parameter.

columns: [
    { text: 'Id', dataIndex: 'Id', width: 50 },
    {
        xtype: 'actioncolumn',
        width: 100,
        text: 'Delete',
        align: 'center',
        items: [{
            icon: '../images/delete.png',
            tooltip: 'Delete',
            handler: function (grid, rowIndex, colIndex, item, e, record) {
                myWin.id = record.data.Id; //where myWin is a reference to the window object and id is just a config.
            }
        }]
    }
]

Upvotes: 0

sra
sra

Reputation: 23975

If you look at the API you will see that the handler has the arguments

  • view : The owning TableView.
  • rowIndex : The row index clicked on.
  • colIndex : The column index clicked on.
  • item : The clicked item (or this Column if multiple items were not configured).
  • e : The click event.
  • record : The Record underlying the clicked row

Where the last one is interesting for you. So you can do it like so

handler: function(grid, rowIndex, colIndex, item, e , record) {
    var win = Ext.create('Ext.window.Window', { 
          autoShow: true, 
          html: record.data.firstname + ' ' + record.data.lastname 
    });
}

And here is a working JSFiddle

Upvotes: 1

Related Questions