ajax - telerik grid gives "Unexpected token <" error when is empty and configured for client operation mode -
i have simple view telerik grid, no javascript file on it. grid:
@{html.telerik().grid(model) .name("mygrid") .columns(columns => { columns.bound(m => m.mycolumn); }) .databinding(data => data.ajax().operationmode(gridoperationmode.client)) .sortable(sort => sort.sortmode(gridsortmode.singlecolumn)) .scrollable(c=>c.height("300px")) .pageable(paging => { paging.enabled(true); paging.pagesize(10); }) .render(); }
when grid empty, error message displayed in console:
if remove databinding line, error goes away, need grid configured client operations. ideas how fix error message?
found workaround. added method on data binding event of grid, prevents requests if grid empty.
<script> function ondatabinding(e) { if ($("#mygrid").data("tgrid").data.length == 0) e.preventdefault(); };
Comments
Post a Comment