Skip to content

Conversation

@dtaylor113
Copy link
Member

@dtaylor113 dtaylor113 commented Jul 7, 2017

Common pagination controls to be used with List, Card, and Table views

image

@akieling, @serenamarie125. @LHinson

JIRA: https://patternfly.atlassian.net/browse/OSUX-25

Copy link
Member

@dlabrecq dlabrecq left a comment

Choose a reason for hiding this comment

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

Other than my pagination service question, everything else looks good to me.

@@ -0,0 +1,24 @@
(function () {
Copy link
Member

Choose a reason for hiding this comment

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

It appears that the pagination service isn't currently used by the pagination component? (And the setPages function isn't implemented in the service itself.) Perhaps we should omit this until we can show an example that works with table and list view, for example?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm..yeah, as the comment in there says it's a placeholder because we may need a service to hold variables to hold the current pagination configs (pageSize, pageNum, etc..) when switching between List, Card, and Table views, but I won't know until I integrate them.

I'll remove the service for now and add it later if needed -thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

@cdcabrera cdcabrera left a comment

Choose a reason for hiding this comment

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

2 questions and a slight behavior modification on the input field

* @param {number} pageNumber The current page number
* @param {number} numTotalItems The total number of items in the data set. When a filter is applied, update the <code>numTotalItems</code>
* accordingly.
* @param {number[]} pageSizeIncrements (optional) Page size increments for the 'per page' dropdown. If not
Copy link
Member

Choose a reason for hiding this comment

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

Just a question here... Do we aim to describe typed arrays?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see the harm in providing this info., just to let them know we're expecting an array of numbers. I can trim it to just 'Array' if you feel that's better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed to: Array to match other ngDoc examples in a-pf repo.

<li ng-class="{'disabled': $ctrl.pageNumber === 1}"><a title="First Page" ng-click="$ctrl.gotoFirstPage()" class="goto-first-page"><span class="i fa fa-angle-double-left"></span></a></li>
<li ng-class="{'disabled': $ctrl.pageNumber === 1}"><a title="Previous Page" ng-click="$ctrl.gotoPreviousPage()" class="goto-prev-page"><span class="i fa fa-angle-left"></span></a></li>
</ul>
<input class="pagination-pf-page" type="text" ng-model="$ctrl.pageNumber" ng-change="$ctrl.onPageNumberChange()"/>
Copy link
Member

Choose a reason for hiding this comment

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

Appears the field lets you continue to a blank page if you manually enter pages that don't exist, maybe add a check to ignore higher than available pages.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah..good catch!

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, defaults to last page if number > last page. Hmm..I should probably do the same for before first page (0, -1, etc).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

We may have inadvertently caused an additional issue, blanking out the field does this... NaN-NaN

screen shot 2017-07-10 at 12 17 16 pm

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi, fixed issue, but now you have to enter the number and then hit Tab or Enter to apply the new page number.

'use strict';
var ctrl = this;

var defaultPageSizeIncrements = [5, 10, 20, 40, 80, 100];
Copy link
Member

Choose a reason for hiding this comment

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

Are we concerned about displaying large increments when the number of results is exceedingly low? Like say 2...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not quite following, if you only have two results/items, but a large pageSize, like 50, it would still only show one page with the two results.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes, not so clear. Had to do with me reducing the number of table entries to "2" then still seeing the page results dropdown showing increments up to 100.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, yeah, still think it's valid to always show all the increments, regardless of results, keeps it more consistent. -thanks

})
.filter('startFrom', function () {
return function (input, start) {
start = +start; //parse to int
Copy link
Member

Choose a reason for hiding this comment

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

Hadn't seen that shortcut in awhile, we could remove the explanation by using parseInt(start).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this was cut&paste code, I'll adjust it. -thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@cdcabrera cdcabrera merged commit b0a1575 into patternfly:master Jul 10, 2017
@dtaylor113 dtaylor113 deleted the pagination branch October 19, 2017 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants