最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Layui數(shù)據(jù)表格 前后端json數(shù)據(jù)接收的方法

 更新時間:2019年09月19日 15:22:04   作者:鄭清  
今天小編就為大家分享一篇Layui數(shù)據(jù)表格 前后端json數(shù)據(jù)接收的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

先上效果圖:

前端數(shù)據(jù)表格:


 <div class="x-body">
  <%-- 數(shù)據(jù)表格 --%>
  <table class="layui-table" lay-data="{
   id:'test',
   url:'/menu/page',
   page:true,
   limits: [10,20,50], //每頁條數(shù)的選擇項,默認(rèn):[10,20,30,40,50,60,70,80,90]
   limit: 10, //每頁默認(rèn)顯示的數(shù)量
   method:'post' //提交方式
   }" lay-filter="test">
   <thead>
    <tr>
     <th lay-data="{field:'id', width:80, sort: true}">編號</th>
     <th lay-data="{field:'name'}">菜單名稱</th>
     <th lay-data="{field:'url', sort: true}">菜單路徑</th>
     <th lay-data="{field:'icon'}">菜單圖標(biāo)</th>
     <th lay-data="{field:'parent'}">菜單</th>
     <th lay-data="{field:'children', sort: true}">子菜單</th>
     <th lay-data="{fixed: 'right', toolbar: '#barDemo', width:250, align:'center'}">操作</th>
    </tr>
   </thead>
  </table>
 </div>
 
 <%-- 這里可以放CRUD按鈕 --%>
 <script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="detail">編輯</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">刪除</a>
 </script>

js代碼

$(function () {
 //注意:這里是數(shù)據(jù)表格的加載數(shù)據(jù),必須寫
 layui.use(['table', 'layer', 'form'], function () {
  var table = layui.table;
  layer = layui.layer;
  form = layui.form;
  //CURD...
 });
 
});

后端需要返回的json數(shù)據(jù)格式:

我們可以自己抽一個工具類出來封裝成前端需要返回的json數(shù)據(jù)格式哦

public class PageUtil<T> {
 
 private int code=0;
 private String msg;
 private Long count; //總條數(shù)
 private List<T> data = new ArrayList(); //裝前臺當(dāng)前頁的數(shù)據(jù)
 //getter/setter方法...
 
}

以上這篇Layui數(shù)據(jù)表格 前后端json數(shù)據(jù)接收的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

肇州县| 遂川县| 察哈| 通辽市| 乐至县| 永登县| 桦甸市| 抚远县| 兰考县| 溆浦县| 长泰县| 宁津县| 内黄县| 漯河市| 孝义市| 高清| 盈江县| 开远市| 甘德县| 白城市| 固原市| 万山特区| 当雄县| 余姚市| 黔西| 茌平县| 临城县| 凌云县| 东辽县| 从化市| 赤峰市| 叙永县| 康马县| 瑞安市| 临沧市| 安庆市| 新营市| 田阳县| 怀安县| 平山县| 长治市|