svelte-simple-datatables icon indicating copy to clipboard operation
svelte-simple-datatables copied to clipboard

Extended the PaginationRowCountHTML.svelte to show pagesTotal etc

Open michapixel opened this issue 3 years ago • 0 comments

$: pagesTotal = Math.ceil($rowsCount / $options.rowsPerPage);
$: start = $pageNumber * $options.rowsPerPage - $options.rowsPerPage + 1
$: end = Math.min($pageNumber * $options.rowsPerPage, $rowsCount)
$: rows = $rowsCount
$: info = $options.labels.info
		.replace('{rowsPerPage}', `<b>${$options.rowsPerPage}</b>`)
		.replace('{pageNumber}', `<b>${$pageNumber}</b>`)
		.replace('{pagesTotal}', `<b>${pagesTotal}</b>`)
		.replace('{start}', `<b>${start}</b>`)
		.replace('{end}', `<b>${end}</b>`)
		.replace('{rows}', `<b>${rows}</b>`)

so that way we could set this in settings:

labels: {
    [...]
   info: 'Page {pageNumber} of {pagesTotal} ({rowsPerPage} rows per page)',
}

michapixel avatar Sep 27 '22 10:09 michapixel