How can i retrieve row data with Editor's delete button?
How can i retrieve row data with Editor's delete button?
JosephSong
Posts: 3Questions: 2Answers: 0
I need to retrieve data from a row before it is deleted so i can delete from my database,
On the server side i'm using node.js.
My code:
editor = new $.fn.dataTable.Editor( {
ajax: {
create: {
"url": "/license_write",
"type": "POST"
},
remove: {
"url": "/license_delete",
"type": "DELETE"
},
edit: {
"url": "/license_update",
"type": "POST"
}
},
table: '#table_id',
fields: [{
"label": "End User ID",
"name": "end_user_id"
}, {
"label": "Sold To",
"name": "sold_to"
}, {
"label": "Start Date",
"name": "start_date"
}, {
"label": "Expiration Date",
"name": "expiration_date"
}]
});
my create and edit work since they send data from input fields,
How can i get the remove button to do the same with a selected row?
This discussion has been closed.
Answers
Hi,
Is it a server-side action that you want to take with the data? The most secure option would be to take the ids requested for deletion in the
/license_delete
handler, read the data from the database and then perform whatever action is required.You could use
preSubmit
to add the data for the selected rows on the client-side, but you would then need to validate that the data submitted is actually the data that belongs to those rows (otherwise someone could monkey with it!), so I think a server-side only approach is the best way to do it.Regards,
Allan