josecebe / twbs-pagination

jQuery pagination plugin (bootstrap powered)
http://josecebe.github.io/twbs-pagination/
Other
1.1k stars 401 forks source link

Why my first page/startPage does not show at load time? #53

Closed sgon00 closed 8 years ago

sgon00 commented 8 years ago

Hi, I am getting crazy with this issue. I did google and tried to solve it for 2 days. But no luck.

I followed the example shown in the doc. But why doesn't my first page load at page load time?

The content is just empty. After load, if I click page 2 and then click page 1 back, the first page will be shown. I have no idea why. I even tried to define startPage: 1 which is useless since that is default value. but no luck. Thank you very much for your help.

sgon00 commented 8 years ago

I figured it out. Simply add:

.trigger('page', 1);
$('#pagination-demo').twbsPagination({...}).trigger('page', 1);

The first page content loaded should be default. If it's not, at least the doc should mention it. It took me 49 hours to figure this out....

eugenesimakin commented 8 years ago

Yes, you're right about trigger page. In the past, code had trigger action.

But then line has been removed. I can't remember why...