// Mise à jour dans les coockies du pageSize de la grid $(document).ready(function () { $(".e-grid .e-pager-itemsinterval .e-drpdwn.e-ul li").click(function () { var d = new Date() // Expiration : 365 jours d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000)) var expires = "expires=" + d.toUTCString() document.cookie = $("#coockiePageSize").html() + "=" + $(this).text() + ";" + expires + ";path=/" }); }); |
But this doesn't work with EJ2
| @Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col => { . . . col.Field("ShipCountry").HeaderText("Ship Country").Width("120").Add(); }).AllowPaging().PageSettings(page => { page.PageSizes(true); }).Render() <script> $(document).ready(function () { var pager = document.querySelector(".e-grid .e-pager").ej2_instances[0]; pager.dropDownChanged = function (e) { var d = new Date() // Expiration : 365 jours d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000)) var expires = "expires=" + d.toUTCString() alert(e.pageSize); }; }); </script> |