Results 1 to 4 of 4

Thread: Update Ext.MessageBox message from ServerSide response

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2010
    Posts
    18
    Vote Rating
    0
      0  

    Default Update Ext.MessageBox message from ServerSide response

    I'm faced with a problem where our customer wants the message of the MessageBox to change based upon some state that is tracked on the server. I know I could send up this state to the panel and just switch off the state when the button is pressed. My issue with doing that is that I'm writing custom code in the javascript that tracks the state and understands which message to display when the button is pressed. I'm looking for a solution or hint on how to make the message of the MessageBox change based upon the server providing the message information.

    These are some ideas I have put together. Let me know if I'm on the right track.
    • On the Click of the button, make a Ajax request to the server for the message, on callback display the message in the messagebox.
      • I've done this approach before but this approach feels clunky to me.
    • Use the Ext.Updater to update the body message. I've never used this approach and I'm unfamiliar with it. So I'm curious if this is the correct approach to doing it. I've also seen the loadScripts property and I'm wondering how it could be used.

    So to summarize: I have a button that needs to launch a confirmation dialog. The confirmation message needs to be different depending upon some state in the server. What I'm looking for is some guidance on how to resolve this problem and also hoping to find a pattern that I could use elsewhere in my customer's application.

    Thanks for any help provided.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    What's wrong with

    Code:
    Ext.Ajax.request({
        //...
        success : function(response) {
            var text = response.responseText;
    
            Ext.Msg.alert('Something', text);
        }
    });
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2010
    Posts
    18
    Vote Rating
    0
      0  

    Default

    There is nothing with that approach. In fact I've used that approach alot. I just was looking to see if others have a more elegant approach. I'm always looking to see if others have another approach to a solution.

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    I see. Yeah, it's what I always have done.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •