Kendogrid destroy() and recreate the table on a new datasource, why do the old table columns still exist?

kendo-grid, kendo-ui, telerik, telerik-grid

Solution

Most probably this is because you are not clearing the content inside the Grid container. e.g.

$('#gridName').data().kendoGrid.destroy();
$('#gridName').empty();

or shorter syntax

$('#gridName').kendoGrid('destroy').empty();

Other way the Grid takes into account the old html that is left - do not forget that the Grid could be initialized from table like here.

Problem

When invoking `destroy()` in KendoUI Grid and then recreate the table on a new `DataSource`: why do the old table columns still exist? The only element here that stays the say is the element. How do I tell the grid to read the new datasource columns (it reads everything else correct). (if I make 2 different elements, they both populate properly but I rather just keep 1 element and replace the elements table by destroy and reinit)

Original source