Refresh after deleting item with paging

I am not sure if this is the default action when deleting an item in the Grid, but if more than 1 page exists in the grid it will refresh to the last page when paging is on.

Example is there are 5 pages of 20 items each in the grid. If I delete an item on the 1st page, when the action is done the grid will show the last page of data even though the pager still shows page 1.


<ejs-grid id="Grid" load="onLoad" allowPaging="true" allowpaging="true"  toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel", "Search"})">
    <e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editsettings>
    <e-grid-pagesettings pageSize="5"></e-grid-pagesettings>
    <e-data-manager url="/Performance/Scorecards/Scorecard?handler=DataSource" insertUrl="/Performance/Scorecards/Scorecard?handler=Insert" removeUrl="/Performance/Scorecards/Scorecard?handler=Delete" updateUrl="/Performance/Scorecards/Scorecard?handler=Update" adaptor="UrlAdaptor"></e-data-manager>
    <e-grid-columns>
        ...
    </e-grid-columns>
</ejs-grid>

public JsonResult OnPostDeleteAsync([FromBody]CRUDModel<Scorecard> value)
        {
            var entity = _context.Scorecard.FirstOrDefault(s => s.Id.ToString() == value.Key.ToString());
            if (entity != null)
            {
                _context.Scorecard.Remove(entity);
                _context.SaveChanges();
            }
            return new JsonResult(value);
        }

4 Replies 1 reply marked as answer

SM Shalini Maragathavel Syncfusion Team December 28, 2020 12:35 PM UTC

Hi Sheldon, 

Thanks for contacting Syncfusion support. 

Based on your query we suspect that the you are facing an issue while perform deleting in the Grid. So, we have prepared a sample and tried to reproduce the issue but we unable to reproduce the mentioned issue at our end.  

Please check below sample for your reference, 

Sample: https://www.syncfusion.com/downloads/support/forum/160945/ze/GRID-3~143769977.zip

Note: The Grid Editing feature requires a primary key column for performing the CRUD operations. To define the primary key, set isPrimaryKey property of e-grid-column tag helper as true in particular column.

If you still face the issue please share the below details that will be helpful for us to a provide better solution. 
1)   Share your complete Grid rendering code.  

2)   If possible please replicate the problem with our above attached sample. 

3)   Please share your Syncfusion package version. 

Let us know if you have any concerns.

Regards,
Shalini M. 



SH Sheldon December 29, 2020 03:06 PM UTC

I wasn't able to reproduce what is happening with the sample provided. It is still happening on the page in question after a few changes.

For the page I am seeing this happen on it only happens as soon as it is put into Grouping. 
The page loads grouped by Location, Aim, Outcome. Deleting a record the paging stays on which ever number the record was deleted from but loads the last page records.
If the grouping is removed before deleting than everything seems to work as expected.

I have attached the cshtml and cshtml.cs pages in question.



Attachment: Index.cshtml_2076f704.zip


SM Shalini Maragathavel Syncfusion Team December 31, 2020 11:28 AM UTC

Hi Sheldon,

Thanks for your patience. 

We have validated this case further from our end and considered this as a bug. We have logged defect report for the same as – “Delete operation is not working properly when initial Grouping is applied ”. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and will include the defect fix in our patch release scheduled on January 13th 2021. We appreciate your patience until then. 
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 
 

Regards, 
Shalini M. 



SM Shalini Maragathavel Syncfusion Team January 18, 2021 12:05 PM UTC


Hi Sheldon, 

We are glad to announce that our Essential Javascript2 patch release (v18.4.34) has been rolled out successfully and in that release we have added the fix for the issue - “Delete operation is not working properly when initial Grouping is applied ”. So please update your package to this version to include the fix.

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Shalini M. 


Marked as answer
Loader.
Up arrow icon