隐藏html和jquery中的列

时间:2015-09-03 15:15:21

标签: javascript jquery html datatables

我正试图在我的视图中隐藏ID,我使用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) 

1 个答案:

答案 0 :(得分:0)

根据documentation,您可以尝试:

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