Marking a row for deletion
Marking a row for deletion
GeorgeHelmke
Posts: 44Questions: 16Answers: 0
I have an editor/table working client side. I want to mark records for deletion, and then when the whole thing is sent to the server, it sorts out what is to be deleted.
$('#DistributionAddressTable tbody ').on('click', 'button', function (event) {
var row = $(this).closest("tr").get(0);
console.log(row);
var aData = DistributionAddressTable.row(row).data();
if (this.name == "DeleteRecord") {
aData.Source = "DELETE";
}
event.stopImmediatePropagation(); //prvents the other on click from firing that fires up the inline editor
});
But this isn't updating in the editor - you do not see the change. What can I do different?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi George,
What you say it isn't updating in the editor - what exactly are you expecting to happen here? Do you have a Editor form that makes use of the
Source
field and it isn't displayingDELETE
(which is should if that is the case)?How are you submitting this information to the server? Through a custom Ajax call or through Editor in some way?
Regards,
Allan
I am sending the local table enmasse over to the server. Works well for edit and create.
Yes, I am expecting the Source field to display the DELETE text.
In the table, or the Editor form? In Editor, it should be that the next time you display that record for editing the
Source
field would indeed show theDELETE
text. In DataTables you would likely need to call therow().invalidate()
method, or just userow().data()
to set the data in the first place.Note that all of this is dependent on you not using server-side processing (I'm afraid I can't remember if you are). If you are using SSP, then manipulating the data at the client-side isn't going to do much good, since the next table draw would just wipe out any changes you have made, loading the new data from the server.
Allan
This worked:
aData.Source = "DELETE";
AddDistributionAddressTable.rows().invalidate();