My application has to do multiple searches against a large database, one search after the other, every few minutes, all day long.
Users click a map, the app gets the latitude and longitude of the location, and then queries the database for entities within a given radius.
The entities are displayed in the grid. Lather. Rinse. Repeat.
I destroy the grid before each search and delay the search for a fraction of a second (I've tried as long as 1.5 seconds) to give the "destruction" time in which to complete.
On the second and subsequent searches, the grid loses its groupable feature. The grouping-is-not-allowed icon when the user tries to drag the column-header to the group-panel.
It may be relevant that the grid is on a panelBar.
function doSearch() {
var existingGrid = $('#grid').data('kendoGrid');
if (existingGrid) {
existingGrid.destroy();
existingGrid.wrapper.html("");
}
setTimeout(function () {
FetchData(); // the success handler for this AJAX call instantiates and configures the grid
}, 222);
}
6 Answers, 1 is accepted
The following demo seems to work as expected. Please check it and let me know if I am missing something.
http://jsfiddle.net/dimodi/Fx5kU/
Dimo
Telerik
Hai Tim,
I can't open your example can you help me,
I have similar scenario, I want destroy existing grid and recreate grid.
Thanks In Advance.
Hello Rajesh,
I recommend the following documentation article about widget destroy:
https://docs.telerik.com/kendo-ui/intro/widget-basics/destroy
Basically, first you need to execute the destroy() method of the Grid, and then empty or remove its DOM element (<div>).
If you remove the Grid <div>, then you can append a new <div> to the page and create a new Grid instance.
If you empty the Grid <div>, then you can reuse this <div> for a new Grid instance.
Do you have a specific issue with this? Please describe in more details, so that we can help.
Regards,
Dimo
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
