View Full Version : gridpanel : itemclick / itemdblclick

12 Aug 2011, 2:27 PM

Here is my code

itemclick: function( view, rec, node, index, e, options ) {
Ext.Ajax.request({url: "ajax.php?type=Read&zid="+rec .internalId,success:function(resp){MyPanel1.loadRecord(Ext.decode(resp.responseText));}});
itemdblclick: function( view, rec, node, index, e, options ) {
if( Ext.getCmp("MIRT"+rec.internalId) == undefined ) {
Ext.Ajax.request({url: "ajax.php?type=Read&zid="+rec .internalId,success:function(resp){
var reponse = Ext.decode(resp.responseText);
MyTabz.add({ id:"MIRT"+reponse.id, title:"stuff", iconCls: "tabs",html:"more stuff" , closable: true,layout:"fit" }).show();

These 2 listeners apply on a grid. They basically "work".

But (there's a but, otherwise I won't post !), the code inside the itemclick listener also executes when I doubleclick on a row...So basically, itemclick ALWAYS execute when itemdblclick runs.
So my ajax query always executes twice... on a double click... Which is annoying

Is it a flaw in my code, is it a extjs bug ? Is it something that can't be fixed due to javascript engine (I use chrome).

Thanks for your answsers.

13 Aug 2011, 9:02 AM
Have you tried using the buffer event config?

14 Aug 2011, 5:43 AM
Nope, I didn't try it (actually as far as I've seen on the Internet, it's the only trick to solve this behavior).

What's weird is that on the feed viewer example, the code for handling click and doubleclick is a bit special. I first wanted to add it in my code, but I don't really understand it... So I didn't add it...
Can somebody explain me how

Actually, my app does almost the same thing as feed viewer (except what I try to do is a kind of webmail).
There's a grid + empty pane in a tab. A simple click on a grid row opens the message in the right pane, a double click opens the message in a new tab. Everything works except that when I doubleclick, it opens a new tab with the message inside, but it also reloads the message inside the right pane which is invisible since I call show() right after I added the tab (know it thanks to xhr network scanner).

The cleanest way would be to replace the doubleclick by a context menu on the row to avoid the buffer trick, 'cause isn't it a bit hacky to use such a trick ?

By the way, I think I found a bug, on the doubleclick, the show() method has the effect to resize my right pane (it becomes ubersmall, so small that only 3 chars can be seen inside). If I remove the .show(), it works as expected, it doesn't "resize" the message area (info : my message pane is a Ext.panel.Panel with layout fit and anchor 100% which is an item of a layout fit, region east and anchor 100%...).

4 Feb 2013, 8:21 AM
You don't need to use itemclick and itemdblclick events.
Use select and itemdblclick events

8 Apr 2013, 4:56 AM
hi stojanovic
did you use select and itemdblclick events on the same record :-/
they did not work for me

8 Apr 2013, 11:13 PM
You can also use beforeselect and itemdblclick combination.
It is important not to use itemclick and itemdblclick, because each dblclick creates 2x click,
while select (or beforeselect) independent "tree".

If you have a dblclick event, there will be only one select event. When the row is selected, does not fire again select event. That's the point.