datatable hide columns set and get the value of the hidden columns

    1. "columns": [ 
       
          { "data": "name" },  
                      { "data": "password" },  
                      { defaultContent: '<td class="caozuo">'+  
          <span class="lookup">查看</span>  '+  
            '<span class="modify">修改</span>  '+  
            '<span class="delete">删除</span></td>'},  
          {"data": "id","visible": false}  
                  ]
      

      Because since the id column to the hidden, the page is no dom nodes, using jquery get less than the value of the id

      The following methods can be used to obtain the id

      1. // get the first line number of clicks
      2.  
        var rowIndex = $(this).parents("tr").index();
      3.  
        // get the id hidden columns here
      4.  
        var id = $('#example').DataTable().row(rowIndex).data().id;

Guess you like

Origin www.cnblogs.com/huoxiansudi/p/11829377.html