gpt4 book ai didi

css - 数据表固定列宽

转载 作者:行者123 更新时间:2023-11-28 10:53:27 25 4
gpt4 key购买 nike

您好,我正在使用数据表在我们的网站上显示一些数据,但由于某些原因我无法将列宽固定为固定大小,它会自动计算列宽。我试过为列指定 {"sWidth": "30px;"} 但没有成功。在这里,我给出了呈现表格的代码

    jQuery('#dynamic')
.html('<table cellpadding="1" cellspacing="1" border="0" class="properties" id="settingsGrid"></table>');

jQuery('#settingsGrid').dataTable({
// "bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaData": aDataSet,
"aoColumns": [
{"sTitle":"catId", "bVisible": false},
{"sTitle" : "Name","sWidth": "30px;"},
{"sTitle" : "Email","sWidth": "30px;"},
{"sTitle" : "Phone no","sWidth": "30px;"},
{"sTitle" : "Location","sWidth": "30px;"},
{"sTitle" : "No of Properties","sWidth": "30px;"},
{"sTitle" : "Web Site URL","sWidth": "30px;"},
{"sTitle" : "Created Date","sWidth": "30px;"}
],
"aoColumnDefs": [ {
"aTargets": [ 0 ],
"mRender": function ( data, type, row ) {
return data +' '+ row[3];
}
}
],
"bAutoWidth": false,
"bDeferRender": true,
"sScrollY": "350",
"bScrollCollapse": true,
"bFilter" : false,
"bSort" : false,
"bInfo" : false,
"bLengthChange": false,
"iDisplayLength": 10,
"oLanguage": {
"sEmptyTable": "No categories available in your name"
},
"oLanguage": {
"sInfoEmpty": "No entries to show"
},
});

谁能指导我哪里出错了?

这是我得到的输出,基本上我需要缩小网站栏。 enter image description here

最佳答案

在 css 中尝试这段代码:

 #settingsGrid td {
width: 30px !important;
}

关于css - 数据表固定列宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22706827/

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