Ajax updating single row
Ajax updating single row
gfawcett22
Posts: 2Questions: 1Answers: 0
I have a DataTable being populated by and ASP.NET controller. A jquery dialog is opened when the user selects and edit button which controls saving the record. On closing the dialog, I wish to ajax update only the record that was modified. Ideally keeping the user on the same table page. Currently, The close function reloads the whole table. The commented out portion gets the row's current data. Here is the code:
`$(document).on("click", function(e){
if(e.target.className.indexOf('edit') !== -1){
var workcenter = e.target.dataset.id;
var table = $('#WorkcenterTbl').DataTable();
$("#workcenterEdit").dialog({
height: 500,
width: 700,
modal: true,
resizable: false,
autoOpen: true,
title: 'Edit Workcenter',
open: function () {
allowableEnter = true;
$(this).load("@Url.Action("WorkcenterEdit", "Admin")?workcenter=" + workcenter);
},
close: function (event, ui) { allowableEnter = false; table.ajax.reload(); table.draw(); /*console.log(table.row(e.target.className.indexOf('edit')).data());*/ }
});
}
})`
This discussion has been closed.
Answers
Or even if the whole table is reloaded, how can I preserve the current page the user is on? I tried passing the record index to ajax.reload(index) and draw(index) and neither worked. I realize I'm trying to modify iDisplayStart, but I don't know which function does that