问题
jQuery Datatables中,如何获取当前页选中的数据?
讲解
其实这个问题的解决方式,在jQuery Datatables 官网的API中写的很清楚的。
https://datatables.net/extensions/select/integration
jQuery Datatables 中有3中主要的方法来获取选中的数据:
选中的是行: rows() and row()
选中的是列:columns() and column()
选中的是单元格:cells() and cell()
解决
jQuery Datatables获取当前页选中的数据
table.rows( {
selected: true,
page: 'current'
} )
.nodes();
在rows()方法中,可以使用selector-modifier
的选项,可以仔细阅读下。
https://datatables.net/reference/type/selector-modifier
其他案例:
获取所有选中的并含有important
class的行。
table.rows( '.important', { selected: true } ).data();
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/155740.html