PDA

View Full Version : How can i add double click event to my grid



Harish kumara
12 May 2009, 12:41 PM
hi all,
am beginner to extjs. my project is to display the file information in the grid when we double click the any entry in the grid it should invoke a function which will take care of displaying that file. I have done single click but don't know how to implement double click..
myGrid= new Ext.grid.GridPanel({
----------------------
----------------------
});
myGrid.addListener('rowclick', displayFile);

I have tried this one but did'nt get any effects on my project..
myGrid.addListener('rowdbclick',displayFile);

please give solution to my problem...

thank you,

regards,
harry

conorarmstrong
12 May 2009, 12:48 PM
use something like



// assuming you have a grid called someGrid

someGrid.on('rowdblclick', function(g, i, e) {
// g is the grid
// i is the index
// e is the event

// for example if store had a name field then
var name=g.getStore().getAt(i).get('name');
// would get it
}


hope this helps! :)

Harish kumara
12 May 2009, 3:02 PM
use something like



// assuming you have a grid called someGrid

someGrid.on('rowdblclick', function(g, i, e) {
// g is the grid
// i is the index
// e is the event

// for example if store had a name field then
var name=g.getStore().getAt(i).get('name');
// would get it
}


hope this helps! :)
--------------------------------------------------------------------------------

I think you did not get my question I tried what you suggest but its not working let me explain you with example...if i do this its working its giving message "am beginner"

FilesListingGrid.on('rowclick',function(g,i,e){Ext.MessageBox.alert('am beginner');});

but its not working when I give as 'rowdbclick'

FilesListingGrid.on('rowdbclick',function(g,i,e){Ext.MessageBox.alert('am begginer');});

What I supposed to do???

carol.ext
13 May 2009, 9:28 AM
but its not working when I give as 'rowdbclick'

That's not spelled right.

It's 'rowdblclick'

Harish kumara
14 May 2009, 12:30 PM
thank you very much carol i got it