losing data on row becoming 'undefined' after render function?
losing data on row becoming 'undefined' after render function?
I'm having trouble tracking down what is happening with my row().data()
after calling render on a column.
I start off with this as a placeholder but I have to recreate the table with new data when the user changes a select
var oTable = $('#resultsTable').DataTable({
data: this.get("controller.currentTableData"),
"iDisplayLength": 25,
responsive: {
details: false
},
columns: [
{
"className": 'details-control', // 0
"orderable": false,
"data": null,
"defaultContent": '' },
{ "data": 'pscPlace', // 1
"defaultContent": ""},
{ "data": 'shooter', // 2
"defaultContent": "" },
{ "data": 'shooter', // 3
"defaultContent": "" },
{ "data": 'shooter', // 4
"defaultContent": "" },
{ "data": 'shooter', // 5
"defaultContent": "" },
{ "data": 'matchPercent', // 6
"defaultContent": "" },
{ "data": 'matchPoints', // 7
"defaultContent": "" }
]
});
The first time when this runs:
// Add event listener for opening and closing details
$('#resultsTable tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = oTable.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
The row().data()
returns valid data but when I use it after having useful data from a behind the scenes ajax call
render: function ( data, type, row ) {
var shooters = _this.get("controller.matchShootersByUuid");
var shooter = shooters[data];
return shooter["sh_fn"] + " " + shooter["sh_ln"];
}
in the row().data()
from the details-control on click
above it returns 'undefined'
TL;DR
Does using the render method on a column do something to the data or do I need to look somewhere else for the problem?
I would gladly add more information if anything is unclear.
Answers
It was something completely different that had nothing to do with DT. Thanks for the awesome product! I'm pushing the boss to donate!
PLEASE CLOSE SUPPORT REQUEST.