PDA

View Full Version : To add more spaces in messageBox.show msg



angelflaree
4 Apr 2008, 3:54 PM
Hi,

I guess this is simple but I didn't find anyone mentioned in previous post. I want my message displayed in the messageBox using Msg.show() display exactly how many empty space character I use.

When I use:


var myInfoMsg = "I want more S P ACE";
Ext.Msg.show({
msg: myInfoMsg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO,
});

The messageBox always trim the multiple spaces to only one space between characters. So the output message looks like "I want more S P ACE"
I tried to use "S"+"&nbsp"+"&nbsp" +"&nbsp"
but it's not working.

Anyone has idea? Thanks :)

4 Apr 2008, 4:07 PM
... why? heh.

angelflaree
4 Apr 2008, 4:55 PM
Because the customer request for alignment in the message output, /:)
e.g. to output sth like this:


"total items :100
total primarySalesman : 20
total classes : 5"

4 Apr 2008, 5:06 PM
Ok, make your life easy. use Templates or just use a generic window.

angelflaree
7 Apr 2008, 9:18 AM
Thanks for notice.

I'm using a generic window now. I include a simple form panel to display those messages.
The simplest way I can achieve alignment is to use the way TextField in a form achieve alignment. But I don't want the frame look in the textField, do you know how to display the text in a plain style where the textField used to be displayed?

7 Apr 2008, 10:01 AM
that's way overkill :)

why not just use the Ext.Template engine instead? :)

It's much lighter weight that the formpanel.

angelflaree
7 Apr 2008, 10:44 AM
mhh, I'm not familiar with Template,
From a post I find:
http://extjs.com/forum/showthread.php?t=17891&highlight=template

It seems I need to override the body of the panel in my messageBox on render, to use that template. But my messgeBox is also used to display other messages, If I do this on render event, it will affect when other messages don't need this template are shown in the messageBox.

I didn't find other helpful examples. If you have, Can you show me one or somewhere in the forum? ;)

7 Apr 2008, 11:36 AM
You can do that. OR just use a template.

Look up the templates in the docs.

angelflaree
3 Oct 2008, 2:27 PM
Actually, the simplest way is to add '\xA0' as space character in the string.

Cheers!