Datatables - change row, then move to another table
Datatables - change row, then move to another table

I'd like to click the button, send Ajax request and if it is success then I'd like to show/hide buttons and move row to another table. Everything works with moving rows, but previously hidden/shown buttons goes back to it's hidden/not-hidden state. Also buttons don't react on clicking on them. Where is the problem?
$('a[name=deactivateItem]').click(function () {
var parent = $(this).parent().parent();
var _itemID = parent.children('#item_ID').val();
var applyButton = parent.find('[name=applyItemChanges]');
var deactivateButton = parent.find('[name=deactivateItem]');
var activateButton = parent.find('[name=activateItem]');
var dialog = bootbox.dialog({
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Proszę czekać...</p>',
closeButton: false,
size: 'small'
})
.on('shown.bs.modal', function () {
$.ajax({
url: "@Url.Action("DeactivatePotentialEstimatedCostItem", "Offers", new { Area = "CRM" })",
type: "POST",
data: { itemID: _itemID },
success: function (data) {
dialog.modal('hide');
if (!data.Success) {
bootbox.alert({
message: data.ErrorMessage,
size: 'small'
});
}
else {
applyButton.hide();
deactivateButton.hide();
activateButton.show();
var addRow = activeTable.row(parent);
notActiveTable.row.add(addRow.data()).draw();
addRow.remove().draw();
}
},
error: function (request, status, error) {
dialog.modal('hide');
bootbox.alert({
message: "Błąd serwera",
size: 'small'
});
}
});
});
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Thats a lot of code to dig through to try understanding what is going on. Please provide a link to your page or a simple test case replicating the issue. This will help us understand and offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin