pagination - VueJS: changing number of paginate values? -
my problem is: i'm trying pagination function datatable, works fine when change limit of items in table, total of pages doesn't update. how can proceed? have filter:
filters: { paginate: function(list) { this.resultcount = this.movimientos.length; if (this.currentpage >= this.totalpages) { this.currentpage = math.max(0, this.totalpages - 1); } var index = this.currentpage * this.upperlimit; return this.movimientos.slice(index, index + this.upperlimit); } }
and here i'm calculating number of pages
computed: { totalpages: function() { return math.ceil(this.resultcount / this.itemsperpage); } }, methods: { setpage: function(pagenumber) { this.currentpage = pagenumber; }, <div v-for="pagenumber in totalpages" class="c-paginacao__select"> <a href="#" v-on:click.prevent="setpage(pagenumber)"> <span class="active">{{pagenumber+1}}</span> </a> </div>
Comments
Post a Comment