KendoGrid dataSource.read() doesn't work after first fail

1 Answer 121 Views
Grid
Lucas
Top achievements
Rank 1
Lucas asked on 13 Sep 2023, 01:49 PM

Let's say I have a program with two buttons, and each one of them populate my grid with different data

. Every time I click any button it reads the data and replace the current data on the grid with the new one. The problem is, let's say button 1 returned an error like 'Uncaught TypeError: Cannot read properties of null', then when I try to click button 2, which has data that doesn't cause errors, then the read method is not called, it doesn't even show on the network tab.

Is it suppose to be like that, or is there a way to make a situation like this work?

Some information: My grid is made by using MVC model (Html.Kendo().Grid<>) approach, with dataSource.Ajax().

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 18 Sep 2023, 08:50 AM

Hi Lucas,

Thank you for the details provided.

In order to handle the described error, I would recommend using the "Error" Event of the DataSource in the Grid.

When an error is thrown, you can use the Error event handler and refresh the Grid. This could be achieved by using the refresh method of the Grid:

I hope this information helps.

Kind Regards,
Anton Mironov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

Tags
Grid
Asked by
Lucas
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or