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

trigger pager events #231

Closed
mvanleest opened this issue Feb 9, 2013 · 4 comments
Closed

trigger pager events #231

mvanleest opened this issue Feb 9, 2013 · 4 comments

Comments

@mvanleest
Copy link

It would be useful to use some of the functions in the pager extension directly.

for instance $("#tableid").gotoPage(1);

I've been trying to get this to work with the current code, but after a couple of hours trying I'm giving up! Any help if this is already possible would be appreciated!

Mike

@Mottie
Copy link
Owner

Mottie commented Feb 9, 2013

Hi mvanleest!

Well, there isn't a clear cut obvious solution for this, but for now you can use the code below, messy I know.

var $t = $('table');
$t[0].config.pager.page = 2; // page to go to
$.data($t[0], 'pagerUpdateTriggered', false); // make sure pager update flag is false
$t.trigger('sortEnd.pager'); // trigger a sortEnd targetting the pager

I think adding a new pager change page method would be best. Look for it in the next update. Maybe it should be named setPage? And used like this:

$('table').trigger('setPage', 2);

Here is a demo using the above code. It'll have to do until I can add the new method.

@mvanleest
Copy link
Author

Thanks! This works for me.

1 thing I would add to the new version is standardized functions and events, so all functionality within the sorter and pager are programmatically available with digging through the code like this.

For instance:

  • setPage()
  • getPage()
  • getTotalPages()
  • getTotalFilteredPages()
  • pageChangeEvent
    etc

Thanks for the help and looking forward to V3 :-)

@Mottie
Copy link
Owner

Mottie commented Feb 9, 2013

Actually everything is saved within table.config.pager:

  • Current page: table.config.pager.page
  • Total rows: table.config.pager.totalRows
  • Total pages: table.config.pager.totalPages
  • Total filtered rows: table.config.pager.filteredRows
  • Total filtered pages: table.config.pager.filteredPages
  • Start row: table.config.pager.startRow
  • End row: table.config.pager.endRow

@Mottie
Copy link
Owner

Mottie commented Mar 1, 2013

I'm guessing this issue has been resolved, so I'm closing it. Please feel free to reopen it if you continue to have problems.

@Mottie Mottie closed this as completed Mar 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants