【发布时间】:2021-04-07 08:57:13
【问题描述】:
将超链接添加到单元格后,JQuery DataTables 单元格宽度被扩展。有没有办法避免这种情况?
同一页面上有两个表格。第一个表列有一个填充第二个表的链接。 它在第一次呈现时间表但第二次呈现列宽不同时起作用。
第一次渲染表格时
调用相同的方法再次渲染同一张表
var tblJanusPlate = $('#tbl').DataTable({
"processing": true,
//"serverSide": true,
"bPaginate": false,
"bFilter": false,
"bInfo": false,
"scrollY": "300px",
"scrollCollapse": true,
"bDestroy": true,
"columns": [{
"data": "Name",
"width": "10%"
},
{
"data": "Country",
"render": function (data, type, row, meta) {
return "<a href='" + data + "' id= '" + row + "' style='color: black; text-decoration: none;' onclick='return populateDetails(this,\"" + row.Name + "\",\"region\",\"" + regDate + "\");' >" + row.Record_Count + "</a>";
}, "width": "10%"
}
]
});
$.ajax({
type: "POST",
url: "Service.asmx/PlateStats",
contentType: "application/json",
dataType: "json",
data: "{ regDate: '" + regDate + "', type: '" + command + "'}",
success: function (response) {
response = JSON.parse(response);
tblJanusPlate.clear();
tblJanusPlate.rows.add(response[0]).draw();
}
}
});
【问题讨论】:
标签: html jquery css ajax datatables