Add buttons on create
Add buttons on create
cvelle89
Posts: 7Questions: 6Answers: 0
hi,
When I want to add new row, I dont know how to create buttons for my last column.
[code]
//CREATE NEW ITEM
$('.button14').click(function () {
$.ajax({
url: "/AdeccoViews/CreateAdeccoView",
contentType: 'application/json;',
data: JSON.stringify({ date: document.getElementById('datepickerCreateModal').value, client: $('#Client :selected').val(), eventType: $('#Event :selected').val() }),
//data: JSON.stringify({ id: t.row('.selected').data()[0] }),//pravi kod
type: 'POST',
success: function (result) {
if (result.id > 0) {t.row.add([
result.id,
document.getElementById('datepickerCreateModal').value,
$('#Client :selected').text(),
$('#Event :selected').text(),
result.name,
'CreateButton, DELETE Button '
]).draw(false);
}
$('#modalCreate').modal('toggle');
swal("Dodato!", "Novi je dodat!", "success");
},
error: function (valid) {
//window.location.href = "/Views/ERROR";
swal("Došlo je do greške!", "Molimo vas da pokušate ponovo!", "error");
}
});
});
[/code]
Thanks!
This discussion has been closed.
Answers
If i understand your question correctly, you would use the column.render function https://datatables.net/reference/option/columns.render to format the incoming string value into what you need.
Agreed. See also the renderer's manual page.
Allan