columnReorder
Fired when the user changes the order of a column.
The event handler function context (available via the this
keyword) will be set to the widget instance.
Event Data
e.column Object
A JavaScript object which represents the column configuration.
e.newIndex Number
The new column index.
e.oldIndex Number
The previous column index.
e.sender kendo.ui.Grid
The widget instance which fired the event.
Example - subscribe to the "columnReorder" event during initialization
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
],
reorderable: true,
columnReorder: function(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(e.column.field, e.newIndex, e.oldIndex);
}
});
</script>
Example - subscribe to the "columnReorder" event after initialization
<div id="grid"></div>
<script>
function grid_columnReorder(e) {
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(e.column.field, e.newIndex, e.oldIndex);
}
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
],
reorderable: true
});
var grid = $("#grid").data("kendoGrid");
grid.bind("columnReorder", grid_columnReorder);
</script>