Sorting a Grid breaks command column delete functionality

Hi,
I'm trying to work out if this is a bug or an error on my end, but I have a grid which has sorting enabled as well as a command column containing the delete button.
I can click the delete button and the grid row removes fine, but if I sort by a column and try to then delete, the selected row doesn't remove. It appears to remove another row from the grid seemingly at random.
I can only assume that it is somehow referencing the original order of the grid and deleting the row that used to be in that position before the sort.
I've tried setting the default sort as well and still experience the same behaviour.
This is essentially making it impossible to use both column sorting and command column deleting together.

Does anyone have any information or has experienced the same issue?

Kind Regards,
Nathan

3 Replies

RS Renjith Singh Rajendran Syncfusion Team July 16, 2018 11:20 AM UTC

Hi Nathan, 

Thanks for contacting Syncfusion support. 

We suspect that you have not set a primary key column in Grid. We suspect that this is the cause of the issue you are facing. We suggest you to set a primary key column when performing CRUD operations, as these operations will be performed in Grid based on the primary key column. Please refer the code example below, 

@Html.EJS().Grid("Grid")... 
.Columns(col => 
    { 
        col.Field("OrderID").HeaderText("OrderID").IsPrimaryKey(true).Add(); 
        ... 
   })...Render() 

 
We have prepared a sample in which after performing sorting, only the selected record gets deleted and not any random records get deleted. Please download the sample from the link below, 
 
If you still face the issue, please share with us the exact scenario to reproduce the issue and get back to us with the following details,  

  1. Share the Essential JavaScript version details(EJ1 or EJ2).
  2. Share a video demonstration of the issue.
  3. Share exact scenario or proper replication procedure.
  4. Share full Grid code example.
  5. Share the stack trace of the issue if any script error occur in console window.

The provided information will help us to analyze the issue and provide you the response as early as possible. 

Regards, 
Renjith Singh Rajendran. 



NA Nathan July 17, 2018 02:43 AM UTC

Hi Renjith,
That has solved the issue!
I've set the keys on the grids I had missed and all is working well.
Thank you for such a quick response.

Kind Regards,
Nathan


RS Renjith Singh Rajendran Syncfusion Team July 17, 2018 04:17 AM UTC

Hi Nathan, 

Thanks for the update. 

We are happy to hear that your requirement has been achieved. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 


Loader.
Up arrow icon