layui获取table的某一行的值

武飞扬头像
PHP中文网
帮助254

前言

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

正文

【自动化渲染】

<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 ) //表格是否全选

本文出至:学新通

系列文章
更多 更多
同类精品
更多 更多
我要评论
我的头像
精彩评论
继续加载