bootstrap-table resize列不起作用,如果我在javascript中设置了列

问题描述 投票:0回答:1

我正在使用以下示例进行可调整大小的列:

https://live.bootstrap-table.com/example/extensions/resizable.html

如果作为链接示例,请在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()
  })

然后我可以调整列的大小。

但是,如果我在js中设置列:

<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}
    );
  });

然后我无法调整列的大小。

如果在js中设置列,如何调整列的大小?

jquery bootstrap-4 bootstrap-table
1个回答
0
投票

此问题已在此pull request中修复

© www.soinside.com 2019 - 2024. All rights reserved.