1. #1
    Sencha User
    Join Date
    Oct 2009
    Location
    The most ridiculous country you could live in : France..... HEY YOU, STOP LAUGHING AT ME !
    Posts
    24
    Answers
    2
    Vote Rating
    0
    n00b is on a distinguished road

      0  

    Default Answered: gridpanel : itemclick / itemdblclick

    Answered: gridpanel : itemclick / itemdblclick


    Hi,

    Here is my code

    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.

  2. Have you tried using the buffer event config?

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tried using the buffer event config?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Oct 2009
    Location
    The most ridiculous country you could live in : France..... HEY YOU, STOP LAUGHING AT ME !
    Posts
    24
    Answers
    2
    Vote Rating
    0
    n00b is on a distinguished road

      0  

    Default


    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%...).

  5. #4
    Sencha Premium Member i.stojanovic's Avatar
    Join Date
    Oct 2010
    Location
    Kragujevac, Serbia
    Posts
    24
    Vote Rating
    0
    i.stojanovic is on a distinguished road

      0  

    Default Wrong approach.

    Wrong approach.


    You don't need to use itemclick and itemdblclick events.
    Use select and itemdblclick events
    www.codelighter.com
    There are 10 types of people in this world, those who understand binary and those who dont

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Location
    Pakistan
    Posts
    82
    Answers
    3
    Vote Rating
    2
    zonaib is on a distinguished road

      0  

    Default


    hi stojanovic
    did you use select and itemdblclick events on the same record
    they did not work for me

  7. #6
    Sencha Premium Member i.stojanovic's Avatar
    Join Date
    Oct 2010
    Location
    Kragujevac, Serbia
    Posts
    24
    Vote Rating
    0
    i.stojanovic is on a distinguished road

      0  

    Default


    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

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi