rowReorder - can i send dragged row id?
rowReorder - can i send dragged row id?
paweltrela
Posts: 25Questions: 10Answers: 0
Hello,
I am using rowReorder and everything works fine.
I just would like to know.
Is it possible to send row which i dragged through the API edit call?
My ajax endpoints looks like this and i am passing there some custom params.
Is there way to add there some parameter with dragged row?
I know that when i use rowReorder it sends my all row params, but i need directly row which i dragged.
ajax: {
create: {
type: "POST",
url: '<%= path %>',
data: function ( d ) {
d.board_id = '<%= @board.id %>';
d.user_id = <%= current_user.id %>;
}
},
edit: {
type: "PATCH",
url: '<%= path %>'+"/_id_",
data: function ( d ) {
d.board_id = '<%= @board.id %>';
d.user_id = <%= current_user.id %>;
}
},
remove: {
type: "DELETE",
url: '<%= path %>'+"/_id_",
data: function ( d ) {
d.board_id = '<%= @board.id %>';
}
}
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This example shows how to setup RowReorder with Editor.
https://editor.datatables.net/examples/extensions/rowReorder.html
Kevin
@kthorngren yes, i know but everything in my case works fine.
When i move my row, all rows involved in this process are sent to backend.
But my backend doesn't know which row was directly dragged and moved.
All rows are 'asc' ordered.
I need to know which row was clicked by the user and dragged into another place
I believe you can use the
row-reorder
event for that information. Thedetail
parameter has anode
object which I believe is the dragged row.Kevin
@kthorngren, thank you, i've checked it and it was row-reorder event.
When i use:
i receive an id of the row i clicked.
But is there easy way to send it to the backend like a normal parameter within an edit ajax call?
The only way i am thinking now is just pass it to the session parameters and call it on the backend side.
Possibly you can use the Editor's
preSubmit
event to add the row_id. I'm guessing it follows after therow-reorder
event. Not sure without testing though.Kevin