Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Add option to disable pagination from outside. #3956

Closed
wants to merge 4 commits into from
Closed

Add option to disable pagination from outside. #3956

wants to merge 4 commits into from

Conversation

TomaszZieleskiewicz
Copy link
Contributor

I want to use this plugin in my project to paginate through tables, but because table content is ajax-based, I dont want to allow user clicking two times at next button at once.
The problem is not only mine, as can be seen in this question.

To solve this issue I have added attribute paginationDisabled to pagination widget. When it is set to true - the widget does not responds to clicking and all buttons are marked as disabled.
Is should be used like this:

<pagination 
    total-items="totalItems" 
    ng-model="currentPage" 
    ng-change="pageChanged()" 
    pagination-disabled="blocked"
></pagination>

paginationDisabled attribute allows disabling pagination from outside of directive. Usefull for ajax-based pagination.
@wesleycho
Copy link
Contributor

I am not sure this is the best approach - I think hooking into ng-disabled and observing the value would be more performant, as well as less complicated to grasp.

@@ -43,11 +42,12 @@ angular.module('ui.bootstrap.pagination', [])
};

this.render = function() {
$scope.page = parseInt(ngModelCtrl.$viewValue, 10) || 1;
$scope.page = parseInt(ngModelCtrl.$viewValue, 10) || 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo this change.

@wesleycho wesleycho modified the milestones: 0.13.1 (Performance), Backlog Jul 19, 2015
@wesleycho
Copy link
Contributor

LGTM, I will add some documentation and then merge it after getting some sleep.

@wesleycho wesleycho closed this in f6edfa5 Jul 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants