Created
February 18, 2023 04:37
-
-
Save aklimaruhina/7caf7e3f63a118cf0bdc24a4489ec98a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first step : css | |
.color-0 { | |
background-color: #F8B195; | |
} | |
.color-1 { | |
background-color: #F67280; | |
} | |
.color-2 { | |
background-color: #C06C84; | |
} | |
.color-3 { | |
background-color: #6C5B7B; | |
} | |
.color-4 { | |
background-color: #355C7D; | |
} | |
Next step: | |
$(document).ready(function() { | |
$('#example').DataTable({ | |
"rowCallback": function(row, data, index) { | |
$(row).addClass('color-' + index % 5); | |
}, | |
"buttons": [ | |
{ | |
"extend": "pdfHtml5", | |
"customize": function(doc) { | |
// Apply custom styles to PDF table rows | |
$(doc.content[1].table.body).find('tr').each(function(i, row) { | |
$(row).addClass('color-' + i % 5); | |
}); | |
} | |
} | |
], | |
// ... | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment