Code Monkey home page Code Monkey logo

tm.pagination's Introduction

tm.pagination

在线DEMO
angular分页插件tm.pagination(解决触发二次请求的问题)
根据条件查询
需要重新定义一个方法

$scope.paginationConf = {
            currentPage: $location.search().currentPage ? $location.search().currentPage : 1,
            totalItems: 8000,
            itemsPerPage: 15,
            pagesLength: 15,
            perPageOptions: [10, 20, 30, 40, 50],
            onChange: function(){
                console.log($scope.paginationConf.currentPage);
                $location.search('currentPage', $scope.paginationConf.currentPage);
            }
        };

11.21 添加href属性,保存页码,并读取页码 image

tm.pagination's People

Contributors

317482454 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tm.pagination's Issues

使用分页的页面,如果带有查询功能,还会出现二次请求的情况

搜索查询的时候,如果当前在的页码不是第1页(假设为第5页),且查询返回的数据长度不满足到当前页码(假设就1条数据),当前页码就会自动变更到第1页,于是又会再去请求一次。

  1. 查询请求的时候请求一次(当前页码为第5页),就算$scope.paginationConf.currentPage设置为1也是一样。
  2. 再次请求一次(当前页码为第1页)。

我的解决办法就是——在查询请求前(非初始化表格数据请求),加个判断如果不是第1页就return;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.