:: Forum >>

Multiple spaces leads to multiple-1 ' ' in grid..

Enter "q" space + space + space + "w" in a cell..

Result is: "q(space)  w"

Workaround:
_Data = Grid JS Array...
your Code......

var _k, ss, _ss="";
for( _k in _Data )
{
while( ss.indexOf(" ")>-1 )
{
ss = rep(ss, " ", "");
}

your Code......


function rep(s, oldvalue, newvalue)
{
var r, re;
re = new RegExp(oldvalue);
r = s.replace(re, newvalue);
return(r);
}

Not optimized, I know.. (:-
FC
Monday, January 30, 2006
I'm finding that strings I deliver into the grid via js array, that have multiple spaces in them (delierately), are having the multiple spaces reduced to one space - whereas I want the multiple spaces preserved.

This post looks like it has something to do with this, although I can't really figure what's going on, or what's being suggested.

Any clarification on this would be appreciated.

Will
Will
Tuesday, February 14, 2006
If you are deliberatly putting in more then 1 space in a string, your browser is going to strip them out unless they are changed to   values. That is why the toolkit does it, in order to preserve the way the information is supposed to look. I suggest that you escape() your strings that are in the array in order to keep your look and feel. Then if you have to send data back to the server, unescape it at the server.

Multiple spaces = 1 space is a browser issue (all browsers, part of the HTML specification)
Jim Hunter (www.FriendsOfAW.com)
Tuesday, February 14, 2006
Yes I kind of realised that this must be happening at the browser level, & tried putting &nbsp's in, but for some reason this didn't work. Anyway I will try escaping strings as you suggest.

Many thanks.
Will
Tuesday, February 14, 2006
Jim

... I'm strugling on this.

What I'm aiming for is to produce a column of timestamps with the following format:

"22:58 14-Feb-2006" (time in UK right now!)

note separation between time and date - makes it much more readable.
Alex has helped me get the format fixed so that it sorts OK (great), but now I just need the separation.

I am producing this as a text string in above format server side and loading it into the grid as a column in a straight 2-d js array. I'm not sure how to handle put in ' 's or when/where to use escape() and unescape() client side.

Apologies if this appears lazy - I'm tired and not really thinking straight I guess. Any further help hugely appreciated!

Will
Will
Tuesday, February 14, 2006
.. well of course in posting this the separation between time and date doesn't show!
Will
Tuesday, February 14, 2006
escape() and unescape() only add back slashes where needed or remove them. If your data is

22:58 14-Feb-2006

With ' ' where the space between minutes and day neither escape() nor unescape() will actually change/add to the data.

I guess for myself I am unclear to what you are trying to escape. Can you explain what you mean by "but now I just need the separation"
Tony
Tuesday, February 14, 2006
Well, I went in to look at my code and it actually looks like I an escaping it at the server. I have a function that replaces all spaces with   and that is the way the data comes down to the web page. We don't allow sorting so I guess this works for me but it might not work for you because you are most likely wanting to sort on this data. Alex might have a cool way to get around this, but I think the solution that worked for me will not be a good solution for you.
Jim Hunter (www.FriendsOfAW.com)
Tuesday, February 14, 2006
Tony

I'm trying to put a clear gap between the time e.g. 22:58 and the date e.g. 14-Feb-2006. It doesn't look too bad in this post, but when in small sized text e.g. font:menu, having just one space between the time and the date makes a column of these difficult to read. I would prefer two or maybe three spaces between them. This is what I was referring to as "separation" (not brilliantly explained I know).

Will
Will
Wednesday, February 15, 2006

This topic is archived.


Back to support forum

Forum search