I have defined a datatable per the below. I am using bootstrap 5. I have read this thread but I still cannot get column width to work. I have tried to change the width using 5%, 500%, 100%, 5px, 500px, 5000px and nothing will change the columnDef.
One guess is that the parent html made be overriding the datatables. I am at a loss as to how to proceed so any help much appreciated.
<code>(function() {
'use strict';
$('#post_index').DataTable({
autoWidth: false,
stateSave: true,
stateDuration: 60 * 60 * 48, // save the state for 2 days.
responsive: true,
pageLength: 10,
lengthChange: false,
searching: true,
ordering: true,
"columnDefs": [
{
"width": "5",
"targets": 0,
},
{
"targets": 'nosort', //Disable ordering on columns which have a class of 'nosort'
"orderable": false
}
],
});
})();
</code>
<code>(function() {
'use strict';
$('#post_index').DataTable({
autoWidth: false,
stateSave: true,
stateDuration: 60 * 60 * 48, // save the state for 2 days.
responsive: true,
pageLength: 10,
lengthChange: false,
searching: true,
ordering: true,
"columnDefs": [
{
"width": "5",
"targets": 0,
},
{
"targets": 'nosort', //Disable ordering on columns which have a class of 'nosort'
"orderable": false
}
],
});
})();
</code>
(function() {
'use strict';
$('#post_index').DataTable({
autoWidth: false,
stateSave: true,
stateDuration: 60 * 60 * 48, // save the state for 2 days.
responsive: true,
pageLength: 10,
lengthChange: false,
searching: true,
ordering: true,
"columnDefs": [
{
"width": "5",
"targets": 0,
},
{
"targets": 'nosort', //Disable ordering on columns which have a class of 'nosort'
"orderable": false
}
],
});
})();