We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to allow both enter keys for textarea field and save batch update(multiple records) of the grid well.

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>

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team July 21, 2017 03:37 AM UTC

Hi Dongil, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and we suspect that you want use enter key in text area as new line navigator and also if we press enter in the Grid edit form then it will go for batch update. We suggest you to use Shift+Enter key in text area for navigate to new line. If we press Enter key alone then it will go for batch update. 

If we misunderstood your query then please get back to us. 

Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon