Hello, I'm trying to bulk batch update in syncfusion grid.
however, there's a text field which is a text area (StarContext) that will allow enter key(new lines).
also, I modified the option .AllowKeyboardNavigation(false).
The symptom is as I remember it worked on normal row by row save.
but in case of Batch Update, I could not use textarea for the field that allow enter key(new lines)
and could not save/changed status(the upper left part icons, save icon - never active) for the records as well.
so, my point is how to both allow text area enter key(new lines) and save BatchUpdate well.
please give me response.
Thank you.
@(Html.EJ().Grid<StarGridViewModel>("StarGridFamily")
.Datasource(ds => ds.Json((IEnumerable<StarGridViewModel>)Model.Where(o => o.DomainArea == "Family").ToList())
.BatchURL("/ContactAssessment/BatchUpdate")
.Adaptor(AdaptorType.RemoteSaveAdaptor))
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.AllowKeyboardNavigation(false)
.AllowTextWrap(true)
.TextWrapSettings(wrap => { wrap.WrapMode(WrapMode.Both); })
.EditSettings(edit => { edit.AllowEditing().EditMode(EditMode.Batch); })
.Columns(col =>
{
col.Field(p => p.StarId).IsPrimaryKey(true).IsIdentity(true).Visible(false).Add();
col.Field(p => p.CaseWorkId).Visible(false).Add();
col.Field(p => p.SubjectPersonId).Visible(false).Add();
col.Field(p => p.DomainArea).Width(20).AllowEditing(false).Add();
col.Field(p => p.DomainAttribute).Width(40).AllowEditing(false).Add();
col.Field(p => p.CurrentScore).Width(20).DataSource(Model.First().FamilyScore)
.ForeignKeyField("Value")
.ForeignKeyValue("Text")
.EditType(EditingType.Dropdown).Add();
col.Field(p => p.OriginalScore).Width(20).DataSource(Model.First().FamilyScore)
.ForeignKeyField("Value")
.ForeignKeyValue("Text")
.EditType(EditingType.Dropdown).Add();
col.Field(p => p.StarContext).EditTemplate(a => { a.Create("createML"); }).ValidationRules(v => v.AddRule("required", true)).Width(140).Add();
//Syncfusion date format in grid needs to be dd-MMM-yyyy as there is an issue with validation when date set to dd/MM/yyyy
col.Field(p => p.PresentedDate).EditType(EditingType.Datepicker)
.ValidationRules(rule => rule.AddRule("dateFormat", "#PresentedDate"))
.DateEditOptions(new DatePickerProperties { DateFormat = "dd-MMM-yyyy" })
.Format("{0:dd-MMM-yyyy}").Width(20).Add();
})
.ClientSideEvents(e => { e.CellEdit("onActionComplete"); })
)
<style>
/*.e-rowcell {
word-wrap:break-word !important;
}*/
.e-grid {
overflow-y:auto !important;
min-height:200px;
}
</style>
<script>
function createML() {
return "<textarea class='form-control starcontext' rows='1' cols='140' style='word-wrap:break-word !important;' >{{:StarContext}}</textarea>";
}
</script>