:: Forum >>
Behaviour of pasting multiple line text into cell
Hi,
Copied multiple line text from a text editor (with linux /n and dos /r/n) into the grip with text-wrap. In different browser I get different behaviour:
IE: only 1st line is pasted
Chrome/Firefox: lines are copied, but new lines are converted automatically into space (by browser or by the grid?)
Had a text filter in the grid to convert /n or /r/n into <br>, but not detecting any from 'text' in
obj.onCellValidated = function(text, column, row){...}
What I am trying to achieve is that user should be able to paste a multi-line text into the grid, and inside the cell, the new lines should be kept in shape.
Thanks
Ray
Sunday, April 1, 2012
Any ideas?
Ray
Thursday, April 12, 2012
Not possible directly. When editing a cell, what you get is a standard HTML input tag to edit, paste, etc., that is a one-line only element.
You have to implement something else which handles multiple lines (a textarea as a template for example).
tmtisfree
Friday, April 13, 2012
Hi tmtisfree,
you mean current active widgets AW.UI.Grid won't handle this? I know I can get away with a html text box implementation but that defeats the whole idea of spreadsheet behavior of the grid I am trying to implement.
Ray
Sunday, April 15, 2012
Yes, no native textarea-like in the grid.
tmtisfree
Thursday, April 19, 2012
Fixed this problem myself. Dunt double click when pasting, so browser does not modify the text. then put these in the codes:
var nl = new RegExp(String.fromCharCode(10),"g");
text = text.replace(nl, "\<br\/>");
var cr = new RegExp(String.fromCharCode(13),"g");
text = text.replace(cr, "");
So other tweaks to enhance the views (hide <br> etc)
Ray
Tuesday, May 1, 2012
This topic is archived.
Back to support forum
Forum search