Reputation: 1201
I am using following example to do resizable columns:
https://live.bootstrap-table.com/example/extensions/resizable.html
If I did as the link example, set columns in thead
:
<table id="table"
data-url="json/data1.json"
data-resizable="true">
<thead>
<tr>
<th data-field="id" data-width="18">ID</th>
<th data-field="name" data-width="20">Item Name</th>
<th data-field="price" data-width="25">Item Price</th>
</tr>
</thead>
</table>
<script>
$(function() {
$('#table').bootstrapTable()
})
then I can resize the columns.
However if I set columns in js like :
<table id="table"
data-url="json/data1.json"
data-resizable="true">
</table>
<script>
var defaultColumns = [
{title: 'Id', field: 'id', width: 180},
{title: 'Name', field: 'name', width: 100},
{title: 'Price', field: 'price', width: 180}
];
$(document).ready(function() {
$( '#table' ).bootstrapTable(
{columns: defaultColumns}
);
});
Then I cannot resize the columns.
How can I resize the columns if I set the columns in js?
Upvotes: 0
Views: 1800