jquery - 如果我在 javascript 中设置列,则引导表调整列大小不起作用
问题描述
我正在使用以下示例来做可调整大小的列:
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中设置列,如何调整列的大小?
解决方案
这在此拉取请求中已修复
推荐阅读
- elasticsearch - 在使用 magento 2 弹性搜索进行产品搜索期间,自定义产品收集过滤器不起作用
- angular - ASPNET 零:未在客户端创建服务类 (Angular)
- javascript - 在 Create-React-App 中键入具有解构赋值参数的函数时出现意外标记
- django - axios 中的 POST 请求,用于在 django restframework api 中创建对象
- azure - ADF v2 确保每日作业将在每小时(24 小时)作业成功后运行
- ios - 应用程序进入后台时出现红条问题(使用 AVCaptureSession)和 AVCamPreviewLayer 混蛋
- android - 我可以从科尔多瓦的 android 访问 localStorage 数据吗
- javascript - 仅在所有过程完成后如何显示对象?
- automation - 从 hiera 评估 puppet manifest 中的哈希值
- python - 如何在 python 中打开终端窗口并发送命令?