michaelbromley / michaelbromley/angularUtils

How to exclude certain array items from total item count on current page

Open
#468 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
842
PR merge metrics
No merged PRs in 30d

Description

Thanks so much for putting this directive together Micheal - it is incredibly useful! I just have one small issue I needed your help with.

Description of issue:
Say I have a list of employee users:
[
{ name: "A", showUser: true}
{ name: "B", showUser: true}
{ name: "C", showUser: false}
]

Imagine this list is 100+ people with the same properties. Out of this list, I'd like the pagination directive to only consider users with showUser set to true when considering which users to show on every page. Basically, if out of the first 40 elements in the list, only 25 of them have showUser set to true, I would want the pagination directive to only display these users whenever show 25 options for pagination is selected. I cannot splice these users from the array as they are needed for other parts of my code.

**Demo**: http://plnkr.co/edit/ZBQHyxutyqAQpbCljIIo?p=preview
In the plunk above, I want to not include any of the sequences that have firstSequence: "true"

Hope I explained my issue well enough - thanks for your help!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the pagination directive demonstrated in the linked Plunker and reproduce the example using the showUser or firstSequence property. Trace how the directive calculates the total and current-page items, then verify that excluded items do not consume the selected page size while retained items still paginate correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.