Editor: Redirect using Edit button
Editor: Redirect using Edit button
kmbonin
Posts: 59Questions: 16Answers: 0
I need to redirect my users to a custom edit page that has a lot of validation and logic on it, but I want to get them there from the standard editor edit button in my datatable. I'm trying to do something like this in my button definition, but I can't seem to grab the ID of the record I am trying to edit.
{
extend: "edit",
text: "Edit DVP&R",
action: function (e, dt, node, config) {
window.location.href("dvpr_edit.aspx?dvprID=" + table.row(this).id);
}
}
How can I get the ID of the row (or a datavalue being passed back from the API) to use in my querystring?
This discussion has been closed.
Answers
I'd suggest dropping
extend: "edit",
since you don't really need any of the functionality of the original edit button.To get the id of the row that is being edited, try using
table.row( { selected: true } ).id)
. I'm presuming you are using the Select extension to allow row selection?Documentation for the Select integration with the API is available here.
Allan