Hi All,
Is there a way to enable user to input MultiLine in a text field?
I tried TextBoxProvider and TextEditorProvider both seems not working.
When the user press "Enter" key, the field just exit edit mode but not go to the next line within the textbox.
Thanks!
David
davidwsk said:When the user press "Enter" key, the field just exit edit mode but not go to the next line within the textbox.
Hello David,
With the suggested manner above the user will be able to edit a cell and when the text of the cell reaches the end automatically the cursor is pushed to the next line and it is not needed the user to press enter. But if you want to do that on enter press or you want to implement custom logic and so on you can use provided by the grid client - side evnt handlers.
Please provide and example of how you would use the client side event handlers to allow the user to press the enter key to add a a new line to the text. Changing the textmode to Multiline just allows for WRAPPING, which is NOT the same as true multi-line editing. The fact that the editor doesn't support or allow true multi-line editing (with the user able to add multiple lines by hitting the enter key) is absurd. If you are going to propose a work around to your products gross limitations, please have the courtesy to provide an example of how you would implement such a work around for such a basic missing feature.
Hello,
You can handle the cell editing client side event ExitingEditMode and cancel the event if it is a column that you are using the multi-line editor for and the enter key was pressed:
function WebDataGrid1_CellEditing_ExitingEditMode(sender, eventArgs){ ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CancelEditModeEventArgs"></param> if (eventArgs.getCell().get_column().get_key() == "Site") { if (eventArgs.get_browserEvent().keyCode == 13) { eventArgs.set_cancel(true); } }}
I have also attached a simple sample that shows this.
Note that this approach changes the behavior so that pressing the enter key will not exit edit mode and users will be required to use the mouse to exit edit mode or tab to the next cell since the enter key will no longer end editing.
Let me know if you have any questions with this matter.
Hello Praveen,
Please let me know if I can provide any further assistance regarding this matter.
To prevent the cell from existing edit mode when tab is pressed, Webdatagrid's KeyDown and cell exiting edit mode clients side events needs to be handled like below
function WebDataGrid1_Grid_KeyDown(sender, eventArgs) { var editedColumn = ""; if (sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode() != null ) { editedColumn = sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode().get_column().get_key(); } if (editedColumn == "Name") { if (eventArgs.get_browserEvent().keyCode == 9 || eventArgs.get_browserEvent().keyCode == 13) { eventArgs.set_cancel(true); }}} function WebDataGrid1_CellEditing_ExitingEditMode(sender, eventArgs) { if (eventArgs.getCell().get_column().get_key() == "Name") { if (eventArgs.get_browserEvent().keyCode == 9 || eventArgs.get_browserEvent().keyCode == 13) { eventArgs.set_cancel(true); }}}
{ var editedColumn = "";
if (sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode() != null ) {
editedColumn = sender.get_behaviors().get_editingCore().get_behaviors().get_cellEditing().get_cellInEditMode().get_column().get_key();
}
if (editedColumn == "Name") {
if (eventArgs.get_browserEvent().keyCode == 9 || eventArgs.get_browserEvent().keyCode == 13) {
eventArgs.set_cancel(true);
}}}
function WebDataGrid1_CellEditing_ExitingEditMode(sender, eventArgs)
{
if (eventArgs.getCell().get_column().get_key() == "Name") {
Attached sample demonstrates the same.
The have tried to cancel the event when the tab key is pressed but the cell is exiting from the editmode. So, I am currently discussing with our Development team regarding this matter and I will update you by the end of the day tomorrow with the progress.
Please let me know if you have any further questions regarding this matter
Hi,
Like a multiline when the tab key is pressed inside the particular column cancel the event and it should work as a tab in the notepad.
Please do the needful.
Thanks in Advance.
Hello Praveena,
I would recommend you to use TextEditorProvider as shown below:
<EditorProviders> <ig:TextEditorProvider ID="WebDataGrid1_TextEditorProvider1"> <EditorControl ClientIDMode="Predictable" MaxLength="4" MultiLine-Rows="4" TextMode="MultiLine"> </EditorControl> </ig:TextEditorProvider> </EditorProviders>
This will limit number of character to 4, It is not needed to write any custom code.
I hope this helps.