gpt4 book ai didi

javascript - 如何增加数据表中的列宽

转载 作者:行者123 更新时间:2023-11-30 09:47:46 24 4
gpt4 key购买 nike

$(document).ready(function() {
var myTable = $('#example').DataTable({
"serverSide": true,
"processing": true,
"paging": true,
"autoWidth": false,
//"searching": { "regex": true },
searching: false,
"lengthMenu": [ [10, 25, 50, 100, 250,500 ,1000], [10, 25, 50, 100, 250,500 ,1000] ],
"ajax": {
"type": "POST",
"url": "packetsScannedListData?total=" +total ,
"dataType": "json",
"contentType": 'application/json; charset=utf-8',
"data": function (data) {
var info = $('#example').DataTable().page.info();
pageOrders = {};
return JSON.stringify(info);
}

},
"columns": [
{ "data": "orderNo" },
{ "data": "crderDate" },
{ "data": "clientName" }
],

});

最佳答案

你可以用like设置列

 "columns": [
{ "data": "orderNo" , "width":"20%" },
{ "data": "crderDate" , "width":"50%" },
{ "data": "clientName" , "width":"30%" }
],

https://datatables.net/reference/option/columns.width

关于javascript - 如何增加数据表中的列宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38122151/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com