Delete Row - Uncaught TypeError: Cannot read property 'error' of undefined
Delete Row - Uncaught TypeError: Cannot read property 'error' of undefined
jorgeloviedo
Posts: 1Questions: 1Answers: 0
Hi all, when I want delete a row I have the next problem "Delete Row - Uncaught TypeError: Cannot read property 'error' of undefined" please could you help me?
this is the code of my app
/*********************************************************
Individual column searching (text inputs)
*********************************************************/
$('#example').find('tfoot th').each(function () {
var title = $('#example').find('thead th').eq($(this).index()).text();
$(this).html('<input type="text" style="font-weight: normal;" class="form-control input-sm" placeholder="Buscar ' + title + '" />');
});
/*********************************************************
Data Table - Data Tool - Data Editor - Apply the search
*********************************************************/
var editor; // use a global for the submit and return data rendering in the examples
$(document).ready(function () {
//Configuration of DataTableEditor Envelope display controller.
$.extend($.fn.dataTable.Editor.display.envelope.conf, {
"attach": "head"
});
//Configuration of DataTableEditor.
editor = new $.fn.dataTable.Editor({
"table": "#example",
"display": "envelope",
"idSrc": "",
"ajax": {
create: {
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: 'https://myfirebasewrapper.apispark.net/v1/employees',
data: function (json) {
return JSON.stringify(json.data);
}
},
edit: {
type: 'PUT',
dataType: 'json',
contentType: 'application/json',
url: 'https://myfirebasewrapper.apispark.net/v1/employees/id',
data: function (json) {
return JSON.stringify(json.data);
}
},
remove: {
type: 'DELETE',
dataType: 'json',
contentType: 'application/json',
url: 'https://myfirebasewrapper.apispark.net/v1/employees/id',
data: function (json) {
return JSON.stringify(json.data);
}
}
},
"fields": [
{ "label": "id:",
"name": "id",
"type": "text",
attr: {
maxlength: 50,
name:"id",
placeholder: 'ID'
}
},
{ "label": "name:",
"name": "name",
"type": "text"
}
]
});
//Configuration of DataTable.
var dataTable = $('#example').DataTable({
"lengthMenu": [
[10, 25, 50, -1],
[10, 25, 50, "Todos"]
],
"order": [
[0, 'asc'],
[1, 'asc']
],
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json"
},
"ajax": {
"url": "https://myfirebasewrapper.apispark.net/v1/employees/",
"type": "GET",
"contentType": "application/json",
"dataType": 'json',
"dataSrc": ""
},
"columns": [
{ "data": "id" },
{ "data": "name" }
],
"autoWidth": true,
"deferRender": true,
"info": true,
"lengthChange": true,
"ordering": true,
"paging": true,
"processing": true,
"searching": true
});
//Configuration of DataTableTool.
var dataTableTool = new $.fn.dataTable.TableTools(dataTable, {
"sRowSelect": "os",
"aButtons": [
{"sExtends": "editor_create", "sButtonText": "Crear", "editor": editor},
{"sExtends": "editor_edit", "sButtonText": "Editar", "editor": editor},
{"sExtends": "editor_remove", "sButtonText": "Delete", "editor": editor},
{"sExtends": "copy", "sButtonText": "Copiar"},
{"sExtends": "csv", "sButtonText": "Csv"},
{"sExtends": "xls", "sButtonText": "Xls"},
{"sExtends": "pdf", "sButtonText": "Pdf"},
{"sExtends": "print", "sButtonText": "Imprimir"}
]
});
//Create Table tool.
$(dataTableTool.fnContainer()).appendTo('h3');
//Function to search.
dataTable.columns().every(function () {
var that = this;
$('input', this.footer()).on('keyup change', function () {
that.search(this.value).draw();
});
});
});
This discussion has been closed.