Prepares the Grid for safe removal from DOM. Detaches all event handlers and removes jQuery.data attributes to avoid memory leaks. Calls destroy method of any child Kendo widgets.
var grid = $("#grid").data("kendoGrid");
// detach events
grid.destroy();
TypeError: rGrid.destroy is not a function
<div id="example" class="k-content"> Select a title from Netflix: <input id="titles"/> <button id="a" /> <script> $(document).ready(function() { var aa = $("#titles").kendoComboBox({ index: 0, placeholder: "Select City", dataTextField: "name", dataValueField: "id_city", filter: "contains", dataSource: { serverFiltering: true, serverPaging: true, pageSize: 20, transport: { } } }); $("#a").click(function (e) { aa.refresh(); }); }); </script> </div><script type="text/javascript"> $(function () { // get a reference to the grid var grid = $("#@gridname").data("kendoGrid"); grid.bind("edit", function (e) { e.container.find("input").select(); }); });</script>@{Html.Kendo().Grid((List<BNYM.EnSIS.Pricing.Contract.VendorPricingGridResponse>)ViewData["PricingGrid"])
.Name("PricingGrid")
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(25)
.Batch(true)
.ServerOperation(true)
.Model(q => q.Id(m => m.ProductID))
.Model(q => q.Id(m => m.CurrencyCode))
)
.Columns(columns =>
{
columns.Bound(m => m.Category).Title("Category").Width(90);
columns.Bound(m => m.ProductID).Title("ProductID").Width(140);
columns.Bound(m => m.CurrencyCode).Title("USD").Width(50);
})
.Resizable(resizing => resizing.Columns(true))
.Scrollable(scrolling => scrolling.Enabled(true).Height(600))
.Sortable(sorting => sorting.Enabled(true))
.Groupable(grouping => grouping.Enabled(true))
.Filterable(filtering => filtering.Enabled(true))
.Reorderable(reorder => reorder.Columns(true))
.Pageable(Pageable => Pageable.Enabled(true).PreviousNext(true).Input(true).PageSizes(true).Refresh(true))
.RowAction(row => row.HtmlAttributes.Add("data-id", row.DataItem.ProductID))
.RowAction(row => row.HtmlAttributes.Add("data-id", row.DataItem.CurrencyCode))
.Selectable(s => s.Mode(GridSelectionMode.Single).Enabled(true))
.Render();
}