
|
@(Html.EJ().Grid<object>("Grid")
.Datasource(ds => ds.URL("/Grid/UrlDataSource")
.Adaptor(AdaptorType.UrlAdaptor))
.AllowSorting(false)
.AllowResizeToFit()
.EnablePersistence(true)
.AllowTextWrap()
.AllowResizing()
.ClientSideEvents(eve =>{ eve.Load("load"); })
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
. . .
})
)
<script>
function load(args) {
setTimeout(function () {
var obj = $("#Grid").ejGrid("instance");// use the grid id to take the grid instance.
if (!obj.model.filterSettings.filteredColumns.length) {
var ignore = ["pageSettings.externalMessage"];
obj.ignoreOnPersist(ignore);
}
}, 20);
}
</script>
|