[英]Datatable fixed column width
Hi I am using the datatable to display some data in our website but some reason I am not able to fix the column width to a fixed size, its calculating column width automatically.嗨,我正在使用数据表在我们的网站上显示一些数据,但由于某种原因,我无法将列宽固定为固定大小,它会自动计算列宽。 I have tried specifying the {"sWidth": "30px;"} for the columns but no luck.
我尝试为列指定 {"sWidth": "30px;"} 但没有运气。 Here I am giving my code which renders the table
在这里,我给出了呈现表格的代码
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"
},
});
Can anyone guide me where I am going wrong?谁能指导我哪里出错了?
Here is a output what I am getting, basically I need to shrink the website column.这是我得到的输出,基本上我需要缩小网站列。
Try this piece of code in css:在 css 中试试这段代码:
#settingsGrid td {
width: 30px !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.