Index column on subset filtered data - Need overall index of all data
Index column on subset filtered data - Need overall index of all data
What I'm trying to do is have one column display the "overall rank" based on the sorted column. The problem, is when I filter those results it will only display the "rank" based on the filtered result. I want to preserve their overall rank in the filtered data. What I think I need to do is: temporarily remove the filter to have the entire sorted results, then re-apply the filter but I haven't been able to figure it out.
Here's what I have:
[code]
var oTable = $('#StatsTable').dataTable({
"fnDrawCallback": function (oSettings) {
if (oSettings.bSorted ) {
for (var i = 0, iLen = oSettings.aiDisplay.length; i < iLen; i++) {
$('td:eq(0)', oSettings.aoData[oSettings.aiDisplay[i]].nTr).html(i + 1);
}
}
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [0, 1] }
],
"aaSorting": [[8, 'desc']],
"sDom": "",
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false
});
$('select#filter).change(function () {
oTable.fnFilter($(this).val())
});
[/code]
Can anyone shed some light? Thanks!
Here's what I have:
[code]
var oTable = $('#StatsTable').dataTable({
"fnDrawCallback": function (oSettings) {
if (oSettings.bSorted ) {
for (var i = 0, iLen = oSettings.aiDisplay.length; i < iLen; i++) {
$('td:eq(0)', oSettings.aoData[oSettings.aiDisplay[i]].nTr).html(i + 1);
}
}
},
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [0, 1] }
],
"aaSorting": [[8, 'desc']],
"sDom": "",
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false
});
$('select#filter).change(function () {
oTable.fnFilter($(this).val())
});
[/code]
Can anyone shed some light? Thanks!
This discussion has been closed.