Console Log
Console Log
andreas.gebetsroither@sps.at
Posts: 6Questions: 4Answers: 0
I want to get the data datum_bis in my console. But how does it works?
var table = $('#example').DataTable( {
// "createRow": function ( row,data,index){
// if ( data[2] <= '10.10.2020' ) {
// $('td', row).eq(2).addClass('highlight');
// }
// },
order: [[ 2, 'desc' ],[ 1, 'asc' ]],
columnDefs: [
{ type: 'de_date', targets: [1,2] } //Datum Sortieren
],
dom: "Bfrtip",
// lengthChange: false,
ajax: "staff.php",
fixedHeader: {
header: true,
footer: true,
headerOffset: 63
},
paging: false,
stateSave: true, //zum speichern der anzuzeigenden Reihen
columns: [
// Textanzeige Tabelle
{ data: null, render: function ( data, type, row ) {
// Combine the first and last names into a single table field
return data.p.vorname+' '+data.p.nachname;
} },
{ data: "weristwo.datum_von", width: "20%" },
{ data: "weristwo.datum_bis", width: "20%" },
{ data: "a.abwesenheitsgrund", width: "20%" },
{ data: "weristwo.firma_ort", width: "20%" },
{ data: "f.name", width: "20%" }
],
select: true,
//Button Farbe
buttons: {
className: "btn-light",
buttons: [
//Neu and Cancel Button
{ extend: 'create', className: 'btn-light', text: 'Neu', editor: editor,
formButtons: [
'Neu',
{ text: 'Cancel', action: function () { this.close(); } }
]
},
//Edit Button + Funktion für vor, zurück und speichern
{ extend: 'selected',className: 'btn-light', text: 'Bearbeiten',editor: editor,
action: function () {
var indexes = table.rows( {selected: true} ).indexes();
editor.edit( indexes, {
title: 'Bearbeiten',
submitOnReturn: false,
buttons: indexes.length === 1 ?
backNext :
'Save',
} );
},
},
//Delete and Cancel Button
{ extend: 'remove', className: 'btn-light', text: 'Löschen', editor: editor,
formMessage: function ( e, dt ) {
var rows = dt.rows( e.modifier() ).data().pluck('bez');
return 'Sicher das du folgende Einträge löschen möchtest? '
},
formButtons: [
{ text: 'Abbrechen', action: function () { this.close(); } },
'Löschen'
]},
]},
createdRow: function(row, data, type, name ) {
console.log(HERE I WANT THE DATA OF DATUM_BIS);
// }
},
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
I would use your browser's debugger and inspect what is being passed into the callback.
You should find what you need in "data" if the field is part of the row created.
https://datatables.net/reference/option/createdRow
Something like
should work.