jsgrid
jsgrid copied to clipboard
Add or editing row in an other URL
Hi, I would like to know if it is possible to redirect the user to another page when clicking on add or edit buttons. I would like to do it externally and, after that, return to the grid.
Congratulations by your great job on jsGrid, and thanks in advance!
Adriano Gonçalves
You can customize your jsGrid like:
$("#grid").jsGrid({
...
/* Insert button */
onItemInserting: function(args) {
// cancel insertion of the item and do anything you want
args.cancel = true;
// redirect
window.location = "http://your-url.example/insert?ID=" + args.item.ID;
},
/* Edit button */
onItemEditing: function(args) {
// cancel edition of the item and do anything you want
args.cancel = true;
// redirect
window.location = "http://your-url.example/edit?ID=" + args.item.ID;
}
);
More: http://js-grid.com/docs/#callbacks