I have the following grid in my table. I am using the first column with a checkbox for selectig teh row.
And it has a header for multiselect(selects all check boxes using jquery)
@(Html.Kendo().Grid<Customer>()
.Name("grid")
.Columns(columns =>
{
columns.Template(@<text></text>)
.ClientTemplate("<input name='chkSelect' id='select_#= Id #' type='checkbox' value='#= Id #' />").Width(30)
.HeaderTemplate("<input id='chkSelectAll' type='checkbox'/>").Locked(true);
columns.Bound(c => c.Name)
.ClientTemplate("<a href='" + Url.Action("Edit", "Customer") + "/#= Id #' " + ">#= Name #</a>").Width(140)
columns.Bound(c => c.CustomerName).Width(110).Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
})
Now I also have feature for show/hide column and I persist them using localstorage like this
function SaveHiddenState() {
var grid = $("#grid").data("kendoGrid");
localStorage["customer-grid-options"] = kendo.stringify(grid.getOptions());
}
And I retreive the saved options using this
$(function () {
var grid = $("#grid").data("kendoGrid");
var options = localStorage["account-grid-options"];
if (options) {
grid.setOptions(JSON.parse(options));
}
});
All these work fine.
But strangely I am losing my header template for my first column alone if I get data from the localstorage. I just get a blank header as if I hadnt included a headertemplate.
Anything that I am missing ?
And it has a header for multiselect(selects all check boxes using jquery)
@(Html.Kendo().Grid<Customer>()
.Name("grid")
.Columns(columns =>
{
columns.Template(@<text></text>)
.ClientTemplate("<input name='chkSelect' id='select_#= Id #' type='checkbox' value='#= Id #' />").Width(30)
.HeaderTemplate("<input id='chkSelectAll' type='checkbox'/>").Locked(true);
columns.Bound(c => c.Name)
.ClientTemplate("<a href='" + Url.Action("Edit", "Customer") + "/#= Id #' " + ">#= Name #</a>").Width(140)
columns.Bound(c => c.CustomerName).Width(110).Filterable(ftb => ftb.Cell(cell => cell.ShowOperators(false)));
})
Now I also have feature for show/hide column and I persist them using localstorage like this
function SaveHiddenState() {
var grid = $("#grid").data("kendoGrid");
localStorage["customer-grid-options"] = kendo.stringify(grid.getOptions());
}
And I retreive the saved options using this
$(function () {
var grid = $("#grid").data("kendoGrid");
var options = localStorage["account-grid-options"];
if (options) {
grid.setOptions(JSON.parse(options));
}
});
All these work fine.
But strangely I am losing my header template for my first column alone if I get data from the localstorage. I just get a blank header as if I hadnt included a headertemplate.
Anything that I am missing ?