javascript - 在 html 和 jquery 中隐藏第 th 列

标签 javascript jquery html datatables

我试图在我的 View 中隐藏 ID th,我使用 jquery 数据表,有没有隐藏它?我不想在我的前端我的 html 和 JS 中看到它,如下所示。

HTML:

<thead>
   <tr>
     <th>Status</th>
     <th>ID</th> 
     <th>Upload Date</th>
     <th>File Name</th>
     <th>Bank</th>
     <th>Upload By</th>
     <th>filepath</th>
     <th>summarypath</th>
     <th>ACTION</th>
   </tr>
</thead>

JS:

"aoColumns": [
    { "sName": "FileStatus", "sClass": "left", "sWidth": "100px" },
    { "sName": "ID", "sClass": "left", "sWidth": "200px" },
    { "sName": "Crdt", "sClass": "left", "sWidth": "100px", "sType": "date" },
    { "sName": "FileName", "sClass": "left" },
    { "sName": "BankName", "sClass": "left", "sWidth": "100px" },
    { "sName": "Crid", "sClass": "left", "sWidth": "150px" },
    { "sName": "filepath", "sClass": "left", "sWidth": "10px", "bVisible": false },
    { "sName": "summarypath", "sClass": "left", "sWidth": "10px", "bVisible": false },
    { "sName": "", "sWidth": "100px", "bSearchable": false,  "bSortable": false, "fnRender": function (oObj) 

最佳答案

根据documentation ,你可以试试:

"aoColumns": [
    { "sName": "FileStatus", "sClass": "left", "sWidth": "100px" },
    { "sName": "ID", "bVisible": false },
    { "sName": "Crdt", "sClass": "left", "sWidth": "100px", "sType": "date" },
    // Following the code

关于javascript - 在 html 和 jquery 中隐藏第 th 列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32379526/

相关文章:

jquery - 有什么办法可以让 jquery 与 node.io 一起工作吗?

javascript - Jquery 并将事件绑定(bind)到 iframe

html - div中并排的图像和文本,想要在调整大小时缩小图像

javascript - 使用 JavaScript 查找圆形 Canvas 交点

Javascript-如何通过 Chartist js 在饼图上制作叠加标签

javascript - 创建一个列,该列是数据表中其他两个列的总和

python - 为什么只有 `static`文件夹下的图片才能显示?

javascript - 选择不提交变更

javascript - 将查询参数与运算符一起用于集合

javascript - angularjs morris 指令从 json rest 创建图表