JSFiddle - React, Tailwind, and code Playground
by jontxo
HTML
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/js/bootstrap.js"></script>
<script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.js"></script>
<script src="https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.bootstrap4.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.colVis.js"></script>
<script src="https://cdn.datatables.net/responsive/2.2.5/js/dataTables.responsive.js"></script>
<script src="https://cdn.datatables.net/scroller/2.0.2/js/dataTables.scroller.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.bootstrap4.css">
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/2.2.5/css/responsive.bootstrap4.css">
<link rel="stylesheet" href="https://cdn.datatables.net/scroller/2.0.2/css/scroller.bootstrap4.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.1/css/all.min.css">
<table id="features-table" class="table-bordered table-sm display nowrap w-100" >
<thead>
<tr>
<th colspan="1"></th>
<th class="header" colspan=3>Features</th>
<th class="metadata" colspan=1>Custom Data</th>
<th class="header" colspan=7>Scenarios</th>
<th class="header" colspan=7>Steps</th>
</tr>
<tr>
<th...
JavaScript
$('#features-table').dataTable({
dom: "<'row'<'col-md-2'l><'col-md-1'B><'col-md-1'f><'col-md-9'>>" +
"<'row'<'col-lg-12't>><'row'<'col-lg-6'i><'col-lg-6'p>>",
buttons: ['colvis'],
order: [[0, "asc"]],
lengthMenu: [[50, 100, 150, -1], [50, 100, 150, "All"]],
deferRender: true,
scrollCollapse: true,
scrollY: 175,
responsive: {
details: {
display: $.fn.dataTable.Responsive.display.modal( {
header: function ( row ) {
var data = row.data();
return 'Details for '+data[0]+' '+data[1];
}
} ),
renderer: $.fn.dataTable.Responsive.renderer.tableAll( {
tableClass: 'table'
} )
}
},
initComplete: function(settings, json) {
if(<%=config.showExecutionTime === false %>){
this.api().column( '.feature-time' ).visible( false );
}
if(<%=suite.results.scenarios.pending === 0 %>){
this.api().column( '.scenarios-pending' ).visible( false );
}
if(<%=Object.entries(suite.metadata).length === 0%>){
this.api().column( '.feature-metadata' ).visible( false );
}
if(<%=suite.results.scenarios.skipped === 0%>) {
this.api().column( '.scenarios-skipped' ).visible( false );
}
if(<%=suite.results.scenarios.undefined === 0%>) {
this.api().column( '.scenarios-undefined' ).visible( false );
}
if(<%=suite.results.scenarios.ambiguous === 0%>) {
this.api().column( '.scenarios-ambiguous' ).visible( false );
}
if(<%=suite.results.steps.failed === 0%>){
this.api().column( '.steps-failed' ).visible( false );
}
...