zoukankan      html  css  js  c++  java
  • bootstrap table 前端分页(client)和服务端分页(server)的配置项差别

    前端分页

    sidePagination: "client", //前端分页(客户端)
    dataField: "count", // 返回的数据必须写死"count"
    totalField: 'data', // 返回的数据必须写死"data"

    前端分页方式是要求 返回的数据中 写死 count 和 data 的,用 其它都不行。

    服务器分页

    sidePagination: "server", //后端分页(服务端)
    dataField: "total", // 默认用"total",可自定义,前后端相同即可
    totalField: 'rows', // 默认用"rows",可自定义,前后端相同即可

    不同分页时的序号

    // 当采用客户端分页时,直接返回“index+1”就是序号了。
    { title: 'No', field: '', align: 'center',
      formatter: function (value, row, index) { 
        return index+1;
      }
    }
     
     
    // 当采用服务端分页时,可以采用下面写法
    { title: 'No', field: '', align: 'center',
        formatter: function (value, row, index) {
            var pageSize = $('#table_datalist').bootstrapTable('getOptions').pageSize; //每页数量
            var pageNumber = $('#table_datalist').bootstrapTable('getOptions').pageNumber; //第几页
            return pageSize * (pageNumber - 1) + index + 1;
        }
    }
  • 相关阅读:
    Eclipse修改背景颜色(豆沙绿)
    项目导入时报错:The import javax.servlet.http.HttpServletRequest cannot be resolved
    jdk1.7 环境变量配置
    Maven的安装、配置及使用入门
    tomcat端口作用
    《Maven实战》
    Maven 详解
    遍历Map的四种方法
    遍历properties文件
    题库终结
  • 原文地址:https://www.cnblogs.com/wfy680/p/15612871.html
Copyright © 2011-2022 走看看