You should define a custom command on the toolbar like this:
toolbar : [ { name : "my-create", text : "Add new record" } ],
Then add an event listener to it, using k-grid- plus the name of the command as a selector.
$(".k-grid-my-create", grid.element).on("click", function (e) { }
Finally, we will use the Kendo UI data source ability to insert at a specific point:
var dataSource = grid.dataSource; var total = dataSource.data().length; dataSource.insert(total, {}); dataSource.page(dataSource.totalPages()); grid.editRow(grid.tbody.children().last());
Please understand that we must go to the last page after inserting the line. This should be fine with columns sorted by date.
Please check the code here: http://jsfiddle.net/OnaBai/sAVGk/
source share