easyui中的datagrid表格的序号翻页时累加

easyui中的datagrid表格的序号默认在翻页时是不累加,每一页都是从1~pageSize值,如下:
在这里插入图片描述
现在需要让这个表格翻页时序号是累加的,方式如下:
添加序号列

<div class=“region-center” data-options=“region:‘center’,border:false”>
<table id=“ad” class=“easyui-datagrid”
data-options=“singleSelect:false,striped:true,pagination:true,fit:true,method:‘post’,title:‘广告列表’”>
<thead>
<tr>
<th data-options="field:'rowNumber',align:'center',formatter:formatId">序号</th>

</tr>
</thead>
</table>
</div>

序号递增函数:

function formatId(value,row,index) {
    var op = $('#ad').datagrid('getPager').pagination('options');
    return op.pageSize*(op.pageNumber-1)+(index+1);
}
posted @ 2019-05-07 20:49  IT-小浣熊  阅读(226)  评论(0)    收藏  举报