自定义easyui-datagid的表格数据序列号

一、使用datagrid时有时需要显示行号,虽然rownumbers="true"属性可以设置,但是当表格有横向滚动条时,就和序列号不协调了,所以需要自定义,解决如下:

columns: [[  
    {field:'index',title:'序号',width:38, align: 'center',formatter:function(val,row,index){
     var options = $("#salesGrid").datagrid('getPager').data("pagination").options; 
     var currentPage = options.pageNumber;
     var pageSize = options.pageSize;
     return (pageSize * (currentPage -1))+(index+1);
    }},

... ...

猜你喜欢

转载自blog.csdn.net/qq_16909139/article/details/80238168