Skip to main content

Pagination

To add pages, import the Pager component and specify values of the required attributes:

  • total - the number of all data rows to be displayed
  • pageSize - the number of rows per page
  • value - the current page (starting from 1); set to 1 by default
<script>
import { Pager } from "wx-svelte-core";
import { Grid } from "wx-svelte-grid";
import { getData } from "./common/data";
const { allData, columns } = getData();

let data = [];
function setPage(ev) {
const { from, to } = ev.detail;
data = allData(from, to);
}
</script>

<Pager total={allData.length} pageSize={8} on:change={setPage} />
<Grid {data} {columns} />