Home > Web Front-end > Layui Tutorial > How to get the value of a certain row of table in layui

How to get the value of a certain row of table in layui

藏色散人
Release: 2023-01-13 00:40:15
Original
10759 people have browsed it

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.

How to get the value of a certain row of table in layui

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: &#39;idTest&#39;}"> …… </table>
Copy after login

[Method rendering]

table.render({ //其它参数省略
  id: &#39;idTest&#39;
});
Copy after login

Call:

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

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template