Home  >  Article  >  Web Front-end  >  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

藏色散人
藏色散人Original
2020-12-07 09:49:0510605browse

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>

[Method rendering]

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

Call:

var checkStatus = table.checkStatus(&#39;idTest&#39;); //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!

Statement:
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