function format (d) {
return 'Full name: <br>'+
'Salary:<br>'+
'The child row can contain any data you wish, including links, images, inner tables etc.';
}
$(function() {
var dtable = $('#table_echipamente').dataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "inc/table_echipamente.php",
"type": "POST"
},
"columns": [
{
"class": "details-control",
"orderable": false,
"data": null,
"defaultContent": ""
},
{ "data": "beneficiar" },
{ "data": "distribuit" },
{ "data": "data_distribuit" },
{ "data": "denumire" },
{ "data": "nr_inventar_nou" },
{ "data": "nr_inventar_vechi" },
{ "data": "gestionar" },
{ "data": "observatii" },
{ "data": "optiuni" }
],
"order": [[1, 'asc']]
});
// Array to track the ids of the details displayed rows
var detailRows = [];
$('#table_echipamente tbody').on('click', 'tr td:first-child', function() {
var tr = $(this).closest('tr');
var row = dtable.row(tr);
var idx = $.inArray(tr.attr('id'), detailRows);
if (row.child.isShown()) {
tr.removeClass('details');
row.child.hide();
// Remove from the 'open' array
detailRows.splice(idx, 1);
} else {
tr.addClass('details');
row.child(format(row.data())).show();
// Add to the 'open' array
if (idx === -1) {
detailRows.push(tr.attr('id'));
}
}
});
// On each draw, loop over the `detailRows` array and show any child rows
dtable.on('draw', function() {
$.each(detailRows, function (i, id) {
$('#'+id+' td:first-child').trigger('click');
});
});
});
ich folgende Fehlermeldung, wenn ich auf die Schaltfläche Öffnen klicken:Tables .row() ist keine Funktion Server Seite Verarbeitung Reihe Details
TypeError: dtable.rows is not a function
Was mache ich falsch? Ich folgte dem Beispiel auf der offiziellen Seite. Ich kann ein ähnliches Problem nicht finden, also ist es sehr seltsam.
Haben Sie das 'dataTable'-Plugin integriert? – Justinas
Ja, ich habe das Plugin, die Tabelle zeigt in Ordnung das Problem ist, dass Zeile Details nicht funktioniert –