国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > JS > 正文

layui獲取選中行數據的實例講解

2024-05-06 16:45:48
字體:
來源:轉載
供稿:網友

第一步: 在jsp文件中設置按鈕

<div class="layui-btn-group demoTable"> <button class="layui-btn" data-type="getCheckData">獲取選中行數據</button> <button class="layui-btn" data-type="getCheckLength">獲取選中數目</button> <button class="layui-btn" data-type="isAll">驗證是否全選</button></div>

第二步:在jsp文件中創建表格

<table class="layui-table" lay-data="{width: 892, height:332, url:'/demo/table/user/', page:true, id:'idTest'}" lay-filter="demo"> <thead>  <tr>   <th lay-data="{type:'checkbox', fixed: 'left'}"></th>   <th lay-data="{field:'id', width:80, sort: true, fixed: true}">ID</th>   <th lay-data="{field:'username', width:80}">用戶名</th>   <th lay-data="{field:'sex', width:80, sort: true}">性別</th>   <th lay-data="{field:'city', width:80}">城市</th>   <th lay-data="{field:'sign', width:160}">簽名</th>   <th lay-data="{field:'experience', width:80, sort: true}">積分</th>      <th lay-data="{field:'classify', width:80}">職業</th>   <th lay-data="{field:'wealth', width:135, sort: true}">財富</th>   <th lay-data="{field:'score', width:80, sort: true, fixed: 'right'}">評分</th>   <th lay-data="{fixed: 'right', width:178, align:'center', toolbar: '#barDemo'}"></th>  </tr> </thead></table>

第三步:寫js,監聽事件

<script>layui.use('table', function(){ var table = layui.table;  var $ = layui.$, active = {  getCheckData: function(){ //獲取選中數據   var checkStatus = table.checkStatus('idTest')   ,data = checkStatus.data;   layer.alert(JSON.stringify(data));  } };</script>

以上這篇layui獲取選中行數據的實例講解就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持VeVb武林網。


注:相關教程知識閱讀請移步到JavaScript/Ajax教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 洪雅县| 宜兰县| 长子县| 中江县| 平阴县| 福建省| 闸北区| 靖西县| 托里县| 自贡市| 图们市| 伊金霍洛旗| 彭州市| 肥东县| 通辽市| 平潭县| 青阳县| 天祝| 新化县| 文安县| 确山县| 永登县| 岱山县| 内江市| 宁武县| 博白县| 芒康县| 乌拉特中旗| 台州市| 甘泉县| 阿尔山市| 萝北县| 阿拉善盟| 新乐市| 拜城县| 临洮县| 滨州市| 南华县| 密云县| 农安县| 茶陵县|