I want to allow the keyboard left and right keys to (or another set of keys if that causes a problem) to paginate forward and backward
I found this plugin that would work perfect https://github.com/iFgR/vue-shortkey
Except I need to be able to add the v-shortkey directive to the paginator itself. I don't know if it's possible to add it any other way.
Alternatively I could do shortkey detection the javascript way and call next/previous on the paginator but I don't know if that's possible.
You mentioned the pagination is its own package.. but which package is that? And can you offer some advice on how I may achieve what I want here?
Thanks!
Figured it out..
https://github.com/matfish2/vue-pagination-2 explains how to paginate programatically. And I'm using https://dmauro.github.io/Keypress/ for the rest.. was super easy to set up. You can close this, thanks!
actually I ran into a problem. I noticed that the table object has the "setPage" function accessible to it so I was able to get it to work by hacking it a bit. But what would have been more helpful is if I could access the pagination object directly so I could use it's methods like next/prev/etc as well as totalPages/totalChunks
Can you tell me how I can get the pagination object please?
figured out a workaround. Here's my code in case it helps anyone
mounted() {
this.paginator = this.$refs.emailList.$children[0];
this.listener = new window.keypress.Listener();
this.listener.simple_combo("left", function () {
if(location.hash == "#list" && this.paginator.page > 1) {
this.paginator.prev();
}
}.bind(this));
this.listener.simple_combo("right", function () {
if(location.hash == "#list" && this.paginator.page < this.paginator.totalPages) {
this.paginator.next();
}
}.bind(this));
},
Glad you sorted it out. Note that you don't have to resort to the $children array, as the paginator has its own pagination ref assigned to it. So:
this.$refs.emailList.$refs.pagination
Is a more accurate way to access the paginator.
Most helpful comment
Glad you sorted it out. Note that you don't have to resort to the
$childrenarray, as the paginator has its ownpaginationrefassigned to it. So:this.$refs.emailList.$refs.paginationIs a more accurate way to access the paginator.