-
12 Aug 2011 2:27 PM #1Sencha User
- Join Date
- Oct 2009
- Location
- The most ridiculous country you could live in : France..... HEY YOU, STOP LAUGHING AT ME !
- Posts
- 22
- Vote Rating
- 0
- Answers
- 2
Answered: gridpanel : itemclick / itemdblclick
Answered: gridpanel : itemclick / itemdblclick
Hi,
Here is my code
These 2 listeners apply on a grid. They basically "work".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(); }}); } }
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.
-
Best Answer Posted by mitchellsimoens
Have you tried using the buffer event config?
-
13 Aug 2011 9:02 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
- Answers
- 3102
Have you tried using the buffer event config?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Aug 2011 5:43 AM #3Sencha User
- Join Date
- Oct 2009
- Location
- The most ridiculous country you could live in : France..... HEY YOU, STOP LAUGHING AT ME !
- Posts
- 22
- Vote Rating
- 0
- Answers
- 2
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 #4
Wrong approach.
Wrong approach.
You don't need to use itemclick and itemdblclick events.
Use select and itemdblclick eventswww.codelighter.com
There are 10 types of people in this world, those who understand binary and those who dont
-
8 Apr 2013 4:56 AM #5
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 #6
Yes.
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.www.codelighter.com
There are 10 types of people in this world, those who understand binary and those who dont


Reply With Quote
