0
Follow
5
View

How to fixed first row at the top of Datatable

ZOOOOM 注册会员
2023-01-26 07:45

Add them as like below:

$(document).ready(function() {
 
  var table = $("#tableSla").DataTable({
    pageLength: 25,
    fixedHeader: false,
    aaSorting: [],
    //orderFixed: {pre: [0, "asc"]},
    columnDefs: [
      {
        "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

<td class="average-css" style="text-align:left;padding:5px;padding-left:10px;">Average_SLA
Process PC10519 PC10520 PC10523 PC0524
97.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 %

About the Author

Question Info

Publish Time
2023-01-26 07:45
Update Time
2023-01-26 07:45

Related Question