Categories | Question details Back To List | ||
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 Answer posted by Stanislav (support) on Oct 07, 2009 05:14 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); } Answer posted on Oct 07, 2009 07:35 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 Answer posted by dhxSupport on Oct 07, 2009 09:26 Try to use "#text_filter_inc instead. Answer posted on Oct 08, 2009 04:45 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 Answer posted by Stanislav (support) on Oct 08, 2009 06:44 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. Answer posted on Oct 12, 2009 03:45 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 |