PHP前端开发

layui如何获取table某一行的值

百变鹏仔 1个月前 (11-16) #layui
文章标签 layui
layui获取table某一行值的方法:首先打开相应的代码文件;然后使用“table.checkstatus('id')”方式获取table某一行的值即可。

本教程操作环境:Windows7系统、layui2.4版,Dell G3电脑。

推荐:《javascript基础教程》《layUI教程》

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

【自动化渲染】

 …… 

【方法渲染】

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

调用:

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