Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

st-pipe not set before st-pagination #148

Closed
brianchance opened this issue Aug 22, 2014 · 7 comments
Closed

st-pipe not set before st-pagination #148

brianchance opened this issue Aug 22, 2014 · 7 comments

Comments

@brianchance
Copy link

For server side paging scenarios, st-pagination runs before st-pipe, leaving no rows. Switching st-pipe from a link to a pre-link seems to fix it...

                link: {
                    pre: function (scope, element, attrs, ctrl) {
                        if (ng.isFunction(scope.stPipe)) {
                            ctrl.preventPipeOnWatch();
                            ctrl.pipe = scope.stPipe.bind(ctrl, ctrl.tableState());
                        }
                    }
                }

I can then set the numberOfPages in the success callback...
tableState.pagination.numberOfPages = Math.ceil(data.totalItems / tableState.pagination.number);

@lorenzofox3
Copy link
Owner

Hello,

Not sure to understand exactly the issue, could you provide a plunkr ?

is this related to #146 ?

Thanks,

Laurent

@dmackerman
Copy link

Hmm, I think so. There's no way to determine the number of pages to show simply because the pipe doesn't get run on initial load.

@brianchance
Copy link
Author

It is essentially the same issue. If you change stPipe to be a pre-link, it runs before stPagination so the initial call works.

As for a plunkr, just add an st-pagination to the pipe/ajax plugin, then remove the initial call to getAPage. It should not work, change stPage to a pre-link and it works. The numberOfPages can then be set in the callback (ala #146 or my sample above).

If you need me to I can create an actual plunkr.

Brian

@dmackerman
Copy link

Right. Changing it to a pre link works for me as well.

@lorenzofox3
Copy link
Owner

Ok thanks, took your fix !

@dmackerman
Copy link

Did this get released?

@lorenzofox3
Copy link
Owner

Yes fe73ca3

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

No branches or pull requests

3 participants