PDA

View Full Version : function in a grid



olvap
12 Apr 2009, 4:20 PM
i need to call a function every time i click in a row. the function have 2 parametres o more, that are columns of the grid.

mjlecomte
12 Apr 2009, 4:22 PM
Add an appropriate listener to pick up the click event you want, and assign a handler (which would be the function you mention presumably).

olvap
12 Apr 2009, 4:31 PM
i have this

ContriColumnModel = new Ext.grid.ColumnModel(
[
{
onclick: MyFunction(colunm1,colunm3),// how do i do this?
header: '#',dataIndex: 'id',width: 50,},
{header: 'Nombre',dataIndex: 'Nombre',width: 200},
{header: 'link',dataIndex: 'link',width: 200}]
);

umarkashmiri
12 Apr 2009, 10:10 PM
Just add the row click listener and call this function into it..... it will automatically be called.

olvap
13 Apr 2009, 4:18 AM
could you give me and example?

shibubh
13 Apr 2009, 4:43 AM
YOURGRID.on('rowclick',YOURFUNCTION,this);


or


YOURGRID.on('rowclick',function(grid,rowIndex,e){
// do what ever you want with grid/


});