layui 給資料表格加序號或行號
阿新 • • 發佈:2018-11-22
摘自:https://blog.csdn.net/qq_40319394/article/details/80657832
第一種需求,只給當前頁加序號
- 給你的資料加上 templet屬性
,cols: [[
{field:'tourPlayerId', width:80, title: 'ID1', sort: true,fixed: 'left',}
,{field:'zizeng', width:80, title: '排名',fixed: 'left',templet:'#zizeng'}
- 在table的下面加上:
<script type="text/html" id="zizeng"> {{d.LAY_TABLE_INDEX+1}} </script>
這樣的話 下一頁裡面的排序不會連著上一頁的,只會重新從1開始排序
第二種方法,包括分頁的資料也加上序號
{ type: 'numbers', title: '序號', width: 180 }
, { field: 'StockCode', title: '倉庫編號', width: 180, sort: true }
, { field: 'StockName', title: '倉庫名稱', width: 180, sort: true }