I try to set up a datable table and I would like the first line (average_sla) to be fixed in premanence, even in case of sorting.
I succeeded in the plug-in absolut .js, to fix the whole line when I sort the column where is "Average_SLA". But when I sort the other columns the row is no longer fixed.
According to this example (http://live.datattes.net/jotifoxa/1/edit), it is possible to do what I want but on my project, I cannot do it.
Can you help me?
:
$( document ).ready(function() {
var namesType = $.fn.dataTable.absoluteOrder( [
{ value: "Average_SLA", position: "top" }
] );
var table = $("#tableSla").DataTable({
pageLength: 25,
fixedHeader: false,
aaSorting: [],
//orderFixed: {pre: [0, "asc"]},
columnDefs: [
{ type: namesType, targets: 0 },
{ "width": "20%", "targets": 0 },
],
createdRow: function (row, data, index) {
if (data[0] == "Average_SLA") {
$(row).addClass("average-css");
}
}
});
});
.average-css{
font-weight:600 !important;
background-color:#333 !important;
color:white !important;
}
SLA
Last update : 2022-06-03 10:08
Process PC10519 PC10520 PC10523 PC0524
<td style="text-align:left;padding:5px;padding-left:10px;">Average_SLA97.94 % 98.29 % 97.28 % 99.08 % Process#1 100.00 % 100.00 % 100.00 % 100.00 % Process#2 98.34 % No Sla No Sla 100.00 % Process#3 98.35 % 98.23 % 98.35 % 98.67 % Process#4 100.00 % 100.00 % 100.00 % 100.00 % Process#5 98.32 % 98.43 % 98.44 % 98.83 % Process#6 98.34 % 99.76 % 97.99 % 98.41 % Process#7 100.00 % 100.00 % 100.00 % 100.00 %
