I have a grid with an associated dataprocessor.
If i edit a cell with contents of say “a b”, this exact string is passed down to the dataprocessor (correctly), and also passed back correctly by my servlet on loadXML, however it is displayed in the grid cell as simply “a b”
If you then edit the cell, you can see the contents are correct “a b”, but how do I get it to render it properly in the grid cell when just viewing the grid?
I think, the problem is not related to dataprocessor.
There are roed, rotxt column types which preserves white spaces during rendering and edit operations. Just use them instead of the current one.
‘rotxt’ and ‘roed’ are read only, right?
Which column type should I used for an input field that can be edited, but also preserves the white space?
Is there any solution to this?
sorry for misleading info, you can use
edtxt
which is editable and preserves whitespaces where possible ( having multiple white-spaces at start of text may still not work, due to html rendering behviours )
I’m not seeing any difference between “ed” and “edtxt”.
In either case, when you edit the cell you can put in like:
a b
But when it renders back, it shows “a b”.
However, if you click on the cell to edit it again, it properly displays
a b
Is there something I need to do to preserve the spaces when in “view” (non edit) mode?
We return the grid contents as XML (from a servlet) and are just putting the string in a element like this:
<cell type='edtxt'>a b</cell>
Should I be wrappering it in CDATA or something?
Place the next code on the page, it will change behavior of edtxt to the necessary in your case one.
[code]function eXcell_edtxt(cell){
if (cell){
this.cell=cell;
this.grid=this.cell.parentNode.grid;
}
this.getValue=function(){
if ((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName == this.cell.atag)))
return this.cell.firstChild.value;
if (this.cell._clearCell)
return "";
return (_isIE ? this.cell.innerText : this.cell.textContent);
}
this.setValue=function(val){
if (!val||val.toString()._dhx_trim() == ""){
val=" ";
this.cell._clearCell=true;
} else
this.cell._clearCell=false;
this.setCValue(val.replace(/ /g," "));
}
}
eXcell_edtxt.prototype=new eXcell_ed;
//#__pro_feature:21092006{[/code]