我有一个包含6列的DataTable,其中第6列的内容有时太大,以致表的宽度超出了屏幕范围。
有什么方法不使表格宽度扩大屏幕宽度,也不保留列的内容吗?
示例图片在这里:
<div id="tables">
<div id="Running" class="tabcontent">
<table id="running" class="table table-striped table-hover dt-responsive display nowrap" width="100%">
</table>
</div>
</div>
JS代码
$.getJSON("realtime/2010/jsonoutput.json", function(data) {
$.each(data, function(key, value) {
job_data = [key, value["Jobname"], value["Username"], value["Queue"], value["Elapsed_Time"], value["RequiredTime"], value["Exec_host"].join(',')];
if (value["State"] == "R") {
running_data.push(job_data);
} else if (value["State"] == "Q")
queue_data.push(job_data);
else
hold_data.push(job_data);
});
$('#running').DataTable({
destroy: true,
responsive: false,
data: running_data,
stateSave: true,
columnsDefs: [{
visible: false,
targets: [1]
}],
columns: [
{ title: "Job ID" },
{ title: "Job Name" },
{ title: "User" },
{ title: "Queue" },
{ title: "Elapsed_Time" },
{ title: "Required_Time" },
{ title: "Exec_host" }
],
});