width keeps resetting even with autowidth set
width keeps resetting even with autowidth set
testdatatables1
Posts: 1Questions: 1Answers: 0
I want to set the width to a fixed % value. It works, but whenever I change the "Show x entries" dropdown which changes the number of entries to display on the change, the width resets. How can I stop this reset?
Html (using angularjs framework, though that shouldn't matter):
<table ng-if="itms && itms.length > 0" id="my-table" class="table table-striped" cellspacing="0">
<thead>
<tr>
<th>c1</th>
<th>c2</th>
<th>c3</th>
<th>c4</th>
</tr>
</thead>
<tfoot>
<tr>
<th>c1</th>
<th>c2</th>
<th>c3</th>
<th>c4</th>
</tr>
</tfoot>
<tbody>
<tr ng-repeat="itm in itms track by $index" repeat-done>
<td>{{itm.c1}}</td>
<td>{{itm.c2}}</td>
<td>{{itm.c3}}</td>
<td>{{itm.c4}}</td>
</tr>
</tbody>
</table>
Javascript:
angular.module('myApp')
.directive('repeatDone', function($timeout) {
return function(scope, element, attrs) {
if (scope.$last) {
$timeout(callback1);
}
}
});
function callback1(){
$('#my-table').DataTable({
"autoWidth": false,
"columns": [
{"width": "20%"},
{"width": "5%"},
{"width": "25%"},
{"width": "50%"}
]
});
}
This discussion has been closed.
Answers
Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
Thanks,
Allan