white space in grid cell content

Hi,



I’m using professional of the grid and i load cell contents from xml file.



If my cell value contains more than one space,grid eliminates the another spaces.



I have changed the cell type from “ro” to “rotxt”, but it works as ever.



Have you any idea?



Thanks,



pyt

It is native functionality of browser - all whitespaces are collapsed to a single one, during rendering.

You can add the next code and continue to use “ro” column type - it will change behavior in necessary way.

eXcell_ro.prototype.setValue=function(val){
val = val.replace(/ /g," "); //convert to the html spaces
return dhtmlXGridCellObject.prototype.setValue.call(this,val);
}

Thank you. It works great! But i have a problem by filtering.
If my first char from cell content a white space is, text_filter ignores it.
Can you help me?
Thanks,
pyt

Try to use "#text_filter_inc instead.

Hi,
unfortunalely it doesn’t work correct.
#text_filter_inc sorts the values by first char, but the filter ignors still the white space as the first char of string .
Can you help me?
Thanks,
pyt

If you are using “space replacement” technique , you need to apply the same code for the filtering as well

grid.attachEvent(“onFilterStart”,function(vals,indexes){
for (var i=0; i<vals.length; i++)
if (vals[i])
vals[i]=vals[i].replace(/ /g," ");
})

It will convert spaces to nbsp during filtering as well, which will math previously converted data.

Hi,
i have added your codes in my html site, but i have this error message:
“vals[i].replace is not a function”.

Can you send me please a sample?

Thanks in advance!

pyt