PDA

View Full Version : HOW TO: Display text message in an Ext.Window???



ben.gillis
3 Feb 2012, 12:21 PM
I want to add/remove simple text messages inside an Ext.Window.

Create some kind of 'items' and .add() it? What kind of item???

Is there no simple way to do myWindow.display('The message I want') and a way to clear it?

vietits
3 Feb 2012, 3:42 PM
Let try html config and update() method.

ben.gillis
3 Feb 2012, 3:47 PM
Yeah, I see that 'update'. I like Ext JS 4, but haven't delved into all that so not sure what I was reading per templates, configs, etc. etc. etc.

For the time being, I went with this:

$(divWithExt-Window).find('.x-window-body').append(message);
where 'message' is inside a span, CSS classed for display control and the text inside that.

vietits
3 Feb 2012, 4:10 PM
If you just want a window functions as a message box for displaying text only then use can use plain text for html config or update() method. For example:


var win = Ext.create('widget.window', {
...
html: 'This text will be displayed when the window are shown',
... // other window configs
});
win.show();
....
win.update('<b>this text will replace the old text</b>');

ben.gillis
3 Feb 2012, 4:12 PM
I have graphs in the window at times. The text I want to put in the window are instructions, error messages, etc. when a graph is not there or cannot be shown for some reason.

vietits
3 Feb 2012, 4:22 PM
Then I think you should include a component (a general component, a label, etc) above or below your graph for this purpose. With a general component, you can still use its update() method.