This might not be the way to go but after a buttonclick i want to update the content of a grid. I do this by making an ajax request and setting a new datasource to the grid with the response. Only problem is after i have done that the search field no longer work
See dojo for example
https://dojo.telerik.com/uvAZuvEW/3
6 Answers, 1 is accepted


nvm, i got it to work by using this
setDataSource instead
$('#grid').data("kendoGrid").setDataSource(new kendo.data.DataSource({ data }))
https://dojo.telerik.com/uvAZuvEW/4
Hello Ole,
Thank you for updating us on the case.
Indeed, using the setDataSource() is the remmended way to go with when the requirment is to set a new data source and re-render the Grid with the new data.
Please let me know if you have any further questions.
Regards,
Nikolay
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Thanks, actually;
if you search for something in the grid, and then replace the datasource is there a way to automaticaly apply the search "filter" to the new datasource ?

haha so sorry, again here to answer my own Q:
const filter = $('#grid').data("kendoGrid").dataSource.filter()
$('#grid').data("kendoGrid").dataSource = new kendo.data.DataSource({ data });
$('#grid').data("kendoGrid").dataSource.filter(filter);
$('#grid').data("kendoGrid").dataSource.read();
$('#grid').data("kendoGrid").refresh();
Hello Ole,
Indeed, that is how a filter can be applied to the grid data source.
Please let us know if anything new arises.
Regards,
Nikolay
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).