I am using the igGrid edit dialog, and when editing text in a text box, when i hit return, the dialog is interpreting that as save. I want save to happen only during the Done button click. I would like return to acutally enter a new line in the text field, not save.
Additionally, I have the text field to be setup using multiline in the ColumnUpdatingSettings config, but the control is only on one line. How can i get the input field to wrap text.
ColumnSettings = new List<ColumnUpdatingSetting>() { new ColumnUpdatingSetting() { ColumnKey = "NoteText", EditorType = ColumnEditorType.Text, TextEditorOptions = new TextEditorModel(){ TextMode = TextEditorTextMode.Multiline } }, }
Hello Caty,
You can add client events when creating the related feature for your GridModel, for example:
GridUpdating u = new GridUpdating(); u.AddClientEvent("editRowEnding", "editRowEndingHandler");
and defined a function with the same name on your page:
function editRowEndingHandler(evt, ui) { if (evt.key === "Enter") return false; }
Let me know if that solves your issue.
Regards,
Maya Kirova
Is it possible to add that editrowending script to the grid from jquery/javascript? If so, what is the event name? I'm creating the grid in c# code on a controller in MVC.
Thank you for posting in our forum.
You can prevent the editRowEnding event when Enter is hit, for example:
editRowEnding: function(evt, ui){ if (evt.key === "Enter") return false; }
For the multi-line editor, please make sure when defining the editor’s template that the type of the target element is not input.
You can set it to div instead, for example:
<tr> <td style="text-align:right;color:#777;"><strong>${headerText}</strong></td> <td><div data-editor-for-${key}="true" /></td> </tr>
Let me know if that solves your issues.