[JavaScript] 纯文本查看 复制代码 var columnIndex = 需隐藏列的columnIndex;
// 隐藏表头
var titleElement = document.querySelector('[id="datatable_datatable$Title_' + columnIndex + '"]');
if (titleElement) {
titleElement.style.display = 'none';
}
// 隐藏数据行中的该列
var dataElements = document.querySelectorAll('[id*="datatable$Data_' + columnIndex + '"]');
dataElements.forEach(function(element) {
element.style.display = 'none';
});
console.log('已成功隐藏xx列');
在datatable表格的queryload事件中写有效,不过如果每次你修改表单用户页面又会重新出现,要清除浏览器缓存才正常 |