<!--click the button after sorting the column-->
<button id="btn"></button>
<div id="Grid"></div>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
allowSorting: true,
actionComplete: function (args) {//after completing the sorting action
if (args.requestType == "sorting") {
console.log(args.columnName);
console.log(args.columnSortDirection);
}
},
actionBegin: function (args) {//at the begining of sorting action
if (args.requestType == "sorting") {
console.log(args.columnName);
console.log(args.columnSortDirection);
}
},
. . . . . .
});
$("#btn").ejButton({
text: "Get Sort",
click: function (args) {
var obj = $("#Grid").ejGrid("instance");
console.log(obj.model.sortSettings.sortedColumns);
}
})
});
</script> |
<div id="Grid"></div>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
dataSource: window.gridData,
allowPaging: true,
allowSorting: true,
enablePersistence: true,
. . . .
});
});
</script> |