Home > Article > Web Front-end > How to get the value of a certain row of table in layui
The method for layui to obtain the value of a certain row of the table: first open the corresponding code file; then use the "table.checkStatus('ID')" method to obtain the value of a certain row of the table.
The operating environment of this tutorial: Windows 7 system, layui version 2.4, Dell G3 computer.
Recommended: "javascript basic tutorial""layUI tutorial"
You can use the table.checkStatus('ID') method to obtain the table in layui The value of a certain row, where ID is the basic parameter.
[Automated rendering]
<table class="layui-table" lay-data="{id: 'idTest'}"> …… </table>
[Method rendering]
table.render({ //其它参数省略 id: 'idTest' });
Call:
var checkStatus = table.checkStatus('idTest'); //idTest 即为基础参数 id 对应的值 console.log(checkStatus.data) //获取选中行的数据 console.log(checkStatus.data.length) //获取选中行数量,可作为是否有选中行的条件 console.log(checkStatus.isAll ) //表格是否全选
The above is the detailed content of How to get the value of a certain row of table in layui. For more information, please follow other related articles on the PHP Chinese website!