1. #1
    Ext User
    Join Date
    Jul 2008
    Location
    Stuttgart, Germany
    Posts
    51
    Vote Rating
    0
    TomToms is on a distinguished road

      0  

    Default How getting an asynchronous MsgBox synchronous?

    How getting an asynchronous MsgBox synchronous?


    Hi everybody

    my problem is the following:
    I have a popup with a grid, a textfield and some buttons (save, load, delete,...) on it. If the user clicks on the save-button and the value of the textfield is the same like a value of the grid, he gets a confirm-msgBox, if he really wants to save the value.
    Because msgBox is asynchronous, the script runs through, without waiting for user interaction (choosing yes or no at the confirm-msgBox). How can I prevent this?
    My code looks like the following:
    [code]
    // Many many code after the save-button is pressed..
    var lenge = querystore.data.length; // the length of my store
    for (var z = 0; z < lenge; z++) {
    if (queryname == querystore.data.items[z].data.query) { // queryname is the value of the textfield // if the value of the textfield == one of the items of the store...
    Ext.Msg.show({
    title: 'Abfrage vorhanden',
    msg: 'Die Abfrage ist bereits vorhaden, soll diese

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    You can't do it like that.

    You will have to process the next item in the list in a callback.

  3. #3
    Ext User
    Join Date
    Jul 2008
    Location
    Stuttgart, Germany
    Posts
    51
    Vote Rating
    0
    TomToms is on a distinguished road

      0  

    Default


    Hi Animal,
    thanks for your help, but could you please post me an example, because I'm not sure, if I got you right...
    But I think, I have a workaround for the problem:
    I create a boolean before the for-loop and set it to true. If the textfield == a value of the store, I set it to false. After the for-loop, I check the boolean, if it is false or true and run (if it is true) the run_the_request()-function.
    To handle the user input with the yes and no-button, I create an on.click() with window.getElementById() and check what button was pressed.
    Do you think, this might work?

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    You can't use a for loop. You must process the next item in a callback. By "example" you mean do the work. You do it.

  5. #5
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,337
    Vote Rating
    75
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    You need to get a firm grip on asynchronous javascript.

  6. #6
    Ext User agodinhost's Avatar
    Join Date
    Aug 2008
    Location
    Rio de Janeiro.
    Posts
    25
    Vote Rating
    0
    agodinhost is on a distinguished road

      0  

    Default


    Hi, I have the same requirements here.
    I agree that a loop waiting for the popup to be closed would be a really bad idea but I can't see any other way to do that ...

    Requirements, omg!

  7. #7
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    As mentioned, you just really need to learn a different way of thinking about the problems when it comes to event based programming. There are always ways of chaining events if you think about it the right way.

  8. #8
    Ext User agodinhost's Avatar
    Join Date
    Aug 2008
    Location
    Rio de Janeiro.
    Posts
    25
    Vote Rating
    0
    agodinhost is on a distinguished road

      0  

    Default


    devnull, I do not disagree with you about the event based programming - I'm just saying that would be really nice one function/method/class to da that. I resolved my problem just using the jscript function 'confirm' but you already know that this function does not have the Ext look and feel.

    IMHO: the requirements are more important than ANY techie talk.

  9. #9
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Pass a callback function!

    How difficult is that?

  10. #10
    Sencha User Novalis's Avatar
    Join Date
    Jul 2008
    Posts
    13
    Vote Rating
    0
    Novalis is on a distinguished road

      0  

    Default


    same requirement for me.
    a callback doesn't help. i need a confirm message on a beforeSelect of a combobox, which stops the selection if not confirmed. but with a callback, the selecting will take place, as soon as the callback is called.
    i use a normal js comfirm as well (which realy hurts me), cause it actually lets me return a false for the beforeSelect
    in general things are, what they look like

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar