xaksis / vue-good-table

An easy to use powerful data table for vuejs with advanced customizations including sorting, column filtering, pagination, grouping etc
https://xaksis.github.io/vue-good-table/
MIT License
2.16k stars 405 forks source link

Pagination options - infoFn shows incorrect data. totalPage parameter is always undefined. #853

Open dipanshusabharwal opened 3 years ago

dipanshusabharwal commented 3 years ago

Issue Type (delete the irrelevant ones)

Specs

What version are you using? 2.21.10

What browser? Chrome Version 90.0.4430.212 (Official Build) (64-bit)

Expected Behavior

What did you expect to happen? The parameter - totalPage in the info-fn pagination options should return valid value.

Actual Behavior

What actually happened? The parameter - totalPage is returning undefined.

Steps to Reproduce the Problem

I am trying to implement my own function to layout pagination information.

Steps :

  1. Run the app using the basic example from getting started documentation.
  2. Set your own page labels and pagination info function under the pagination-options.
  3. Add the following line in pagination-options of your app, so that you use totalPage paramter :
infoFn: (params) =>
`Showing ${params.firstRecordOnPage} to ${params.lastRecordOnPage} of page ${params.currentPage} out of ${params.totalPage} pages. Total Records: ${params.totalRecords}`,

image

jsfiddle

If you provide a jsfiddle reproducing the issue, it'll be addressed much faster. you can use this as base

https://jsfiddle.net/mkx60gp7/

aditsud commented 3 years ago

use ${params.totalPages} instead of ${params.totalPage}

it works