1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    Chennai,TamilNadu,India
    Posts
    5
    Vote Rating
    0
    ramesbabu is on a distinguished road

      0  

    Default Ext Js Button

    Ext Js Button


    Hi,
    I'm using Extjs button for save operation,

    new Ext.Button({
    text: 'Save',
    id:'save_id',
    width:'108px',
    height: '25px',
    renderTo: 'save_button',
    listeners: {
    click: function(){ save(); }
    }});

    I'm calling this method by F9 (functional key on keyboard) and
    also by on click with mouse.

    By F9:

    document.onkeyup = function (e) {
    var unicode=e.keyCode? e.keyCode : e.charCode;
    if(unicode==120){
    Ext.getCmp('save_id').fireEvent("click", this);
    }
    }


    while simultaneously access using keyboard and mouse , save function called for two times
    but my requirement is , the function should called once even though accessed by keyboard and mouse.
    Please guide me to resolve this parallel issue.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    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


    First, I wouldn't fire the click event. I would use the handler config on the button and then execute the handler method on the button.

    So you only want to fire save once per x amount of time or while an action is taken?

    If while an action is taken I would set a variable or property to say that the action is pending and when the action is finished change that var/prop so that the save method will continue to fire (of course the save method should check the var/prop to allow it to continue to execute).

    If after x amount of time, same as above only set the var/prop as a date object and then check the difference between that var/prop with the current time and if the difference is more than your x amount of time then allow the save method to continue to execute.
    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.

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Chennai,TamilNadu,India
    Posts
    5
    Vote Rating
    0
    ramesbabu is on a distinguished road

      0  

    Default Ext js button

    Ext js button


    Hi Dude,
    Can you give some examples about this parallel issue, It is possible without time factor.

  4. #4
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    This is just basic JS logic.

    Set a global/namespaced variable:
    Code:
    var currentlySaving;
    Then when you call the save function:
    Code:
    if(currentlySaving != true) {
        save()
    }
    Then in your save function:
    Code:
    currentlySaving = true;
    // Save logic here
    currentlySaving = false;

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Location
    Chennai,TamilNadu,India
    Posts
    5
    Vote Rating
    0
    ramesbabu is on a distinguished road

      0  

    Default Ext js button

    Ext js button


    Thanks a lot... willigogs and mitchellsimoens

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,756
    Vote Rating
    828
    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


    I wouldn't do a global variable. Functions are really objects and can have properties (watch out for memory leaks tho)
    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.

Thread Participants: 2

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