Hi Jeffrey,
Thanks for using Syncfusion products.
From your query and code example, we can understood that you want to access the edited data before saving the corresponding data.
The currentViewData gets updated once the data saved. To access the edited data when “Batch” editing, then we can use the method “getBatchChanges”.
Refer to the below screenshot,
Refer to the below code example,
@(Html.EJ().Grid("Grid") .Datasource(ds => ds.URL(@Url.Action("BatchDataSource", "Reallocate")).BatchURL(@Url.Action("BatchUpdate", "Reallocate")).Adaptor(AdaptorType.UrlAdaptor)) .EditSettings(edit => { edit.AllowEditing().EditMode(EditMode.Batch); }) .AllowFiltering() .AllowGrouping(true) .ShowColumnChooser() .Columns(col => { col.Field(r => r.IncludeInReallocation).TextAlign(TextAlign.Center).EditType(EditingType.Boolean).Add(); }))
<script type="text/javascript"> var gridInstance = $("#Grid").ejGrid("instance"); var data = $("#Grid").ejGrid("getBatchChanges")["changed"]; for (var i = 0; i < data.length; i++) { if (data[i].IncludeInReallocation) { // do stuff } } |
Refer to the Help document for more clarification about getBatchChanges method,
http://help.syncfusion.com/js/api/ejgrid#methods:getbatchchanges
If we misunderstood your requirement, please provide below details,
1. Share the controller code where you have preselected the rows.
2. In which scenario/event you are using the above code example.
3. Code example if you are using any AJAX post for calling the controller method.
4. Full code example used for rendering Grid.
Provided details will help to analyze and provide a solution as early as possible.
Regards,
Gowthami V.