boostraptable獲取隱藏列數據


  針對 bootstraptable 中 hiden 為 true 的列 。

  隱藏列不會渲染為 DOM 元素,所以我們無法通過 DOM 元素獲取。

  我們需要通過 bootstraptable 數據源的數據對象獲取,其中包含隱藏列的數據。

    //獲取當前行的 bootstrap 數據對象
    getDataRow = function (obj) {
        var index = obj.parent().parent().attr('data-index');
        var data = $('#bootstrap-table').bootstrapTable('getData');
        console.dir(index);
        console.dir(data);
        console.dir(data[index]);
        return data[index];
    }

  可以根據每行 tr 元素的 data-index 屬性獲取其行號。

  通過  $('#bootstrap-table').bootstrapTable('getData') 獲取數據源對象,會返回一個數組。

  我們根據行號取數組中的元素即可,隱藏的未隱藏的都在這個 Obj 中。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM