diff --git a/src/molecules/gv-table/gv-table.js b/src/molecules/gv-table/gv-table.js index 728a5b43..367c913f 100644 --- a/src/molecules/gv-table/gv-table.js +++ b/src/molecules/gv-table/gv-table.js @@ -605,12 +605,13 @@ export class GvTable extends withResizeObserver(LitElement) { _renderPagination() { if (this.options && this.options.paging && this._itemsProvider) { + const nbPages = Math.ceil(this._itemsProvider.length / this.options.paging); const paginationData = { first: 1, - last: this._itemsProvider.length / this.options.paging, + last: nbPages, total: this._itemsProvider.length, current_page: this._page, - total_pages: this._itemsProvider.length / this.options.paging, + total_pages: nbPages, }; return html``; } diff --git a/src/molecules/gv-table/gv-table.stories.js b/src/molecules/gv-table/gv-table.stories.js index fdd23860..a2c39147 100644 --- a/src/molecules/gv-table/gv-table.stories.js +++ b/src/molecules/gv-table/gv-table.stories.js @@ -140,6 +140,10 @@ export const pagination = makeStory(conf, { items: [{ items: [...apiItems, ...apiItems], options: { ...apiOptions, paging: 2 }, title: 'APIs', order: 'name' }], }); +export const paginationPartialPage = makeStory(conf, { + items: [{ items: [...apiItems, ...apiItems], options: { ...apiOptions, paging: 5 }, title: 'APIs', order: 'name' }], +}); + export const components = makeStory(conf, { items: [ {