3.2.0

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
April 1,
Any ideas?
Ray
April 12,
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
April 13,
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
April 15,
Yes, no native textarea-like in the grid.
tmtisfree
April 19,
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
May 1,

This topic is archived.

See also:


Back to support forum