layui如何获取table某一行的值?

layui中可以使用table.checkStatus('ID')方法获取table某一行的值,其中ID为基础参数。

【自动化渲染】

<table class="layui-table" lay-data="{id: 'idTest'}"> …… </table>

【方法渲染】

table.render({ //其它参数省略
  id: 'idTest'
});

调用:

var checkStatus = table.checkStatus('idTest'); //idTest 即为基础参数 id 对应的值
console.log(checkStatus.data) //获取选中行的数据
console.log(checkStatus.data.length) //获取选中行数量,可作为是否有选中行的条件
console.log(checkStatus.isAll ) //表格是否全选

更多相关知识请关注前端学习网站

以上就是layui如何获取table某一行的值?的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » Layui 教程