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