Grid incorrectly displaying removed rows

2 posts, 1 answers
  1. Danny
    Danny avatar
    4 posts
    Member since:
    Jun 2015

    Posted 05 Jun 2017 Link to this post


    There is an issue with the Kendo Grid when interacting with the grid after removing all items from the dataSource directly. The grid behaves as expected when there are items in the grid, but when the last row is removed and a sort or filter is applied, the original records all reappear in the grid.

    Here is a jsfiddle that shows the issue happening:

    In the jsfiddle, if you remove all four rows and then sort a column, all four records are added back into the grid. We use this approach to removing items versus calling the removeRow method on the grid object directly because we have many situations in which we need to remove upwards of thousands of rows at a time and it is inefficient to remove them one at a time with the removeRow method. The pushDelete method on the dataSource, in my experience, is also very inefficient at deleting thousands of records at a time (although we are using 2015 R2, so I'm not sure if improvements have been made since then).

    Is there a solution where we can continue to update the property and keep it in sync with the grid, even when all items are deleted? Or must we use another approach?

    Thank you.

  2. Answer
    Stefan avatar
    3067 posts

    Posted 07 Jun 2017 Link to this post

    Hello Danny,

    The demonstrated result is expected because when the Grid data is empty and operations like sort and filtering are made the Grid is requesting the data which in this case is the original data.

    If the Grid is using a remote data source, and the changes are synced on the server the issue will not occur.

    The other option will be to set the Grid with empty data, and then use the data method to set in data originally:

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top