This is a migrated thread and some comments may be shown as answers.

[Solved] parsererror on databinding empty data when client operation mode

1 Answer 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
TC
Top achievements
Rank 2
TC asked on 17 Jan 2013, 08:25 PM
My grid is in client operation mode.
I'm trying to empty out the grid data via javascript:

var myGrid = $('#MyGrid').data('tGrid');
myGrid.total =0;
myGrid.dataBind([]);

the dataBind with empty data is generating a parsererror.


also, I have other buttons outside the grid that will make ajax call to grab new json data and then bind to the grid. It is working fine as long as the json data that comes back is not empty. However, when it is empty

{ "data": [], "total": 0 }

it is also generating a parsererror but it did clear out the grid. However, the page navigation state did not get reset i.e. Page 1 and Showing 0 of 0... and still contains the navigation state per the last set of data.

What is the proper way for the grid to handle the data when it is empty?


1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 22 Jan 2013, 03:55 PM
Hello,

The approach is correct and when I tested it locally, the data was cleared and the page status was updated correctly without any errors. Could you share the code you are using or a small runnable demo so I can check the setup?

Regards,
Daniel
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Grid
Asked by
TC
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or