DataTables Editable
DataTables Editable
brunocruz
Posts: 1Questions: 0Answers: 0
I've add DataTables Editable to my table to able to add and delete some rows.
The add part works great, but I'm having some problem with the delete part, because I can't select the rows.
By what I've seen in the example all I've to do is to add the delete URL, something like this:
[code].makeEditable({sDeleteURL: "/DeleteURL"});[/code]
But that dosent make my rows selectable so I can delete anthing.
My full code is:
[code]
$(function () {
var oTable = $('.table-@Model.Numero').dataTable(
{
"oLanguage": { "sUrl": "/LanguageURL" },
"bProcessing": true,
"bFilter": false,
"sPaginationType": "full_numbers",
"iDisplayLength": 10,
"bLengthChange": false,
"aoColumnDefs": [{ "sClass": "center-col", "aTargets": ['align-center-col'] },
{ "sClass": "read_only", "aTargets": ['read-only-col'] },
{ "sClass": "small-width-col", "aTargets": ['small-col'] }],
"aaSorting": [[0, "desc"]],
"bScrollCollapse": true,
"bServerSide": true,
"sAjaxSource": '/SourceURL',
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "Numero", "value": $(this).find("#Numero").val() });
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
}).makeEditable({
sAddNewRowFormId: 'form-@Model.Numero',
sAddNewRowButtonId: 'btn-@Model.Numero',
btnDeleteRow: 'btn-del-@Model.Numero',
sAddURL: "/AddURL",
sDeleteURL: "/DeleteURL"
});
});[/code]
Thanks for the help
The add part works great, but I'm having some problem with the delete part, because I can't select the rows.
By what I've seen in the example all I've to do is to add the delete URL, something like this:
[code].makeEditable({sDeleteURL: "/DeleteURL"});[/code]
But that dosent make my rows selectable so I can delete anthing.
My full code is:
[code]
$(function () {
var oTable = $('.table-@Model.Numero').dataTable(
{
"oLanguage": { "sUrl": "/LanguageURL" },
"bProcessing": true,
"bFilter": false,
"sPaginationType": "full_numbers",
"iDisplayLength": 10,
"bLengthChange": false,
"aoColumnDefs": [{ "sClass": "center-col", "aTargets": ['align-center-col'] },
{ "sClass": "read_only", "aTargets": ['read-only-col'] },
{ "sClass": "small-width-col", "aTargets": ['small-col'] }],
"aaSorting": [[0, "desc"]],
"bScrollCollapse": true,
"bServerSide": true,
"sAjaxSource": '/SourceURL',
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "Numero", "value": $(this).find("#Numero").val() });
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
}).makeEditable({
sAddNewRowFormId: 'form-@Model.Numero',
sAddNewRowButtonId: 'btn-@Model.Numero',
btnDeleteRow: 'btn-del-@Model.Numero',
sAddURL: "/AddURL",
sDeleteURL: "/DeleteURL"
});
});[/code]
Thanks for the help
This discussion has been closed.