View Full Version : Update Ext.MessageBox message from ServerSide response

23 Oct 2012, 4:53 AM
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.

25 Oct 2012, 6:45 AM
What's wrong with

success : function(response) {
var text = response.responseText;

Ext.Msg.alert('Something', text);

25 Oct 2012, 7:00 AM
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.

25 Oct 2012, 8:30 AM
I see. Yeah, it's what I always have done.