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

goToPage on init #37

Closed
graphicsxp opened this issue Jul 11, 2013 · 2 comments
Closed

goToPage on init #37

graphicsxp opened this issue Jul 11, 2013 · 2 comments

Comments

@graphicsxp
Copy link

ng-table params are read from URL, so when I browse to :

http://mydomain?page=5

I initialize the tableParams like this:

$scope.tableParams = new ngTableParams({
page: $location.search().page ? $location.search().page : 1
});

However, the pagination control is not set to the correct page number. I think this is because the method goToPage is only called on click event of the pagination numbers. But in this particular case, it would be great if it could be set to the right page on init.

How can I do that ?

@esvit
Copy link
Owner

esvit commented Jul 13, 2013

I have no such problem, see this example http://esvit.github.io/ng-table/#!/demo5?page=2 maybe you have error in other place?

@esvit esvit closed this as completed Jul 13, 2013
@graphicsxp
Copy link
Author

Ok, I've found out what's wrong. It is related to a modification I've made to your code in order to fix issue #33

I had to change line 25 in params.cofee:

this[key] = (if isNumber(data[key]) then parseFloat(data[key]) else data[key])

to

this[key] = data[key]

If I change back, then it fixes the page issue. But I have to find a workaround for #33. Pages are always numbers, filters are not.

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

2 participants