How to clear Kendo grid rows without invoking databound method?

1 Answer 6605 Views
Grid
Avinash
Top achievements
Rank 1
Avinash asked on 13 Apr 2016, 05:12 PM
I have a grid with databound method which shows the message 'No Data Found for the search' in case no data gets retrieved after performing search. Now i have added a radio buttons which when clicked needs to clear the old data from the grid. The issue is i am using the code
$(grid).data("kendoGrid").dataSource.data([]);

 which does clear the grid but it also shows 'No Data Found for the search' message. Since user didn't perform any search but only changed the radio button it doesn't seem right to display that message in the grid. So, i was wondering if there was a way to clear the grid without invoking the databound method.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 15 Apr 2016, 07:09 AM

Hello Avinash,

Each time the Grid is bound to a new set of data, the dataBound event will be triggered. You could for example set a flag variable, then check it in the event handler and act accordingly.
E.g.

var isRadioClicked = true;
$(grid).data("kendoGrid").dataSource.data([]);

Regards,
Dimiter Madjarov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Avinash
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or