<ej:Grid ID="Grid" runat="server" AllowPaging="true" ClientIDMode="Static" Selectiontype="Multiple">
. . .
<ClientSideEvents RowSelected="OnRowSelected" DataBound="OnDataBound" />
</ej:Grid>
<script type="text/javascript">
window.addEventListener("unload", function () {
var grid = $("#Grid").ejGrid("instance");
/* Saving the selected row indexes
* grid.selectedRowIndexes will contain the index of the rows selected.
*/
window.localStorage.setItem("ejGridSelection", JSON.stringify(grid.selectedRowsIndexes))
});
function OnDataBound() {
var indexes = JSON.parse(window.localStorage.getItem("ejGridSelection"));
if (indexes)
this.selectRows(indexes); //Re-Select on initial rendering
}
</script>
|
<Grid>
<ej:Grid ID="Grid1" AllowPaging="True"
EnableRowHover="true"
AllowReordering="false" Locale="en-US"AllowMultiSorting="false"
AllowSelection="True" Selectiontype="Multiple" AllowFiltering="true"
runat="server">
. . .
<PageSettings PageSize="15" />
<SelectionSettings EnableToggle="true" />
<ClientSideEvents DataBound="OnDataBound" RecordClick="OnrecordClick" RowSelected="OnRowSelected" />
</ej:Grid>
<script type="text/javascript">
function OnrecordClick(args) { //Will be triggered on every record click.
// Do something
}
</scrip> |
window.addEventListener("unload", function () {
var grid = $(".e-grid").ejGrid("instance");
// Save the filtered record details
window.localStorage.setItem("ejFilterRecords", JSON.stringify(grid.model.filterSettings.filteredColumns))
});
function OnDataBound() {
var Filter = JSON.parse(window.localStorage.getItem("ejFilterRecords"))
if (Filter) {
this.model.filterSettings.filteredColumns = Filter; // Re-store the filtered details
this.refreshContent(); // Refresh the Grid content
}
} |