Creating a table structure dynamically with Datatable
<table id="resource_report" width="70%" class="table dataTable no-footer" role="grid">
<thead>
<tr role="row"><th align="left" class="sorting_asc" tabindex="0" aria-controls="resource_report" rowspan="1" colspan="1" style="width: 135px;" aria-sort="ascending" aria-label="Name: activate to sort column descending">Name</th><th class="sorting" tabindex="0" aria-controls="resource_report" rowspan="1" colspan="1" style="width: 95px;" aria-label="
Week 1&xnbsp;(1-4)
: activate to sort column ascending">
Week 1 (1-4)
</th><th class="sorting" tabindex="0" aria-controls="resource_report" rowspan="1" colspan="1" style="width: 102px;" aria-label="
Week 2&xnbsp;(5-11)
: activate to sort column ascending">
Week 2 (5-11)
</th><th class="sorting" tabindex="0" aria-controls="resource_report" rowspan="1" colspan="1" style="width: 111px;" aria-label="
Week 3&xnbsp;(12-18)
: activate to sort column ascending">
Week 3 (12-18)
</th><th class="sorting" tabindex="0" aria-controls="resource_report" rowspan="1" colspan="1" style="width: 111px;" aria-label="
Week 4&xnbsp;(19-25)
: activate to sort column ascending">
Week 4 (19-25)
</th><th class="sorting" tabindex="0" aria-controls="resource_report" rowspan="1" colspan="1" style="width: 111px;" aria-label="
Week 5&xnbsp;(26-31)
: activate to sort column ascending">
Week 5 (26-31)
</th></tr>
</thead>
</table>
Styling applied from bootstrap-default.css
.table thead th {
background-color: #16a085;
color: #fff !important;
}
Attempted removal using the code below, but it did not work
$(resource_report).removeAttr(" color:'', background-color:'' ");
The appearance of the table header is as shown in this image https://i.sstatic.net/o6Ok9.png
and after inspecting the element using F12, it looks like this
https://i.sstatic.net/foYKL.png
- How can I remove the properties of the class
table thead th
so thatbackground-color
andcolor
are not applied without modifying anything in the CSS file? - How do I ensure the table header appears correctly with the proper width and not compressed?