<script type="text/x-jsrender" id="template">
<input id="pageSize" type="text" style="text-align:center; margin:0px;border:none;width:32px;height:23px" />
<span style="padding:5px">items per page</span>
</script>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: data,
allowPaging: true,
pageSettings: { pageSize: 10, enableTemplates: true, template: "#template", showDefaults: true },
actionComplete: function (args) {
$(".e-pagercontainer.e-template").css('border-style', 'none');
if (args.requestType == "refresh")
debugger
$("#pageSize").ejDropDownList({ // here we will change input box into ejDropDownList
width: 55, value: args.model.pageSettings.pageSize, dataSource: dropData, // here we will set dataSource and other properties for ejDropDownList
change: function (args) { // this is change event of ejDropDownList and this event triggers after the value changed
$("#Grid").ejGrid({ "pageSettings": { pageSize: parseInt(args.value) } }); // here we will change pagesize in model
}
});
}
});
});
</script> |
<style>
#Grid .e-pagercontainer {
display: inline-flex;
height: 27px;
}
</style>
<script type="text/javascript">
$(function () {
// the datasource "window.gridData" is referred from jsondata.min.js
var data = ej.DataManager(window.gridData).executeLocal(ej.Query().take(50));
$("#Grid").ejGrid({
. . .
actionComplete: function (args) {
$(".e-pagercontainer.e-template").css('border-style', 'none');
if (args.requestType == "refresh")
$("#pageSize").ejDropDownList({ // here we will change input box into ejDropDownList
width: 55, height: 27, value: args.model.pageSettings.pageSize, dataSource: dropData, // here we set the height and width properties of ejDropDownList
. . .
}
});
}
});
});
</script> |
@(Html.EJ().Grid<EditableOrder>("Grid")
. . .
.PageSettings(p => p.ShowDefaults().EnableTemplates().Template("#pagerTemplate"))
. . .
) |