PDA

View Full Version : [CLOSED] Grid cell editor for long text



ATLAS
Aug 13, 2013, 9:15 AM
I have a grid in which a column for user comments may be long (say up to 1024 chars) and will have carriage returns etc. I've got the cell rendering sorted using .Wrap(true) and .Renderer(RendererFormat.Nl2br) properties. The problem comes to editing the cell contents. How do I attach an editor that will also apply the same wrap and Nl2br and that will retain carriage returns ( or <br> markup ) when the comments are committed to store/database. I've exhausted Google/Forums searches and "suck it and see" development.

Secondly, as the database field size may in future be changed to 4096, I would like to specifiy max width and height to the editor and have it apply scrollbars automatically for long text.

Daniil
Aug 13, 2013, 12:36 PM
Hi @ATLAS,

What field are you using as an Editor? A TextArea?

ATLAS
Aug 13, 2013, 2:41 PM
Hi @ATLAS,

What field are you using as an Editor? A TextArea?

Hi Daniil,
Yes, I'm using a TextArea now. I was't when I posted orginal question :-(.

That does solve the multiline edit but I hit a few other issues which I've worked around. The first is sizing the editor. It seems to default to a single line height, even when the text in the cell is long. AutoSize on the editor doesn't have an affect (don't know if it should!). I've explicitly set the height on the editor to 50 which is acceptable for me. If I set it more than that, selecting the top cell in the column cause the editor to render it's top bounds outwith that of the grid. It is now usable for editing.

The last issue is that when double clicking the cell to invoke the editor, selects the row and checks the checkbox of the CheckboxSelectionModel column! Don't want that. I seen to recall seeing similar issue reported by someone else but would welcome your reply.

Daniil
Aug 13, 2013, 5:01 PM
That does solve the multiline edit but I hit a few other issues which I've worked around. The first is sizing the editor. It seems to default to a single line height, even when the text in the cell is long. AutoSize on the editor doesn't have an affect (don't know if it should!). I've explicitly set the height on the editor to 50 which is acceptable for me. If I set it more than that, selecting the top cell in the column cause the editor to render it's top bounds outwith that of the grid. It is now usable for editing.

Please try this setup:

<ext:Column
runat="server"
Text="Test"
DataIndex="test"
Wrap="true">
<Editor>
<ext:TextArea runat="server" />
</Editor>
<EditorOptions>
<AutoSizeConfig Height="BoundEl" />
</EditorOptions>
</ext:Column>



The last issue is that when double clicking the cell to invoke the editor, selects the row and checks the checkbox of the CheckboxSelectionModel column! Don't want that. I seen to recall seeing similar issue reported by someone else but would welcome your reply.

A row gets selected on single click before editing. I cannot see any appropriate way to distinguish cases when a row should be selected or not, because a selection model doesn't know about editing which, moreover, happens on double click.

Maybe, something like this:

<ext:CellEditing runat="server">
<Listeners>
<BeforeEdit Handler="e.grid.getSelectionModel().deselect([e.record]);" Delay="100" />
</Listeners>
</ext:CellEditing>

But again, it gets selected on first click, then gets unselected on next click/editing. You can consider setting up ClicksToEdit="1" for the CellEditing.