Skip to content

PaginationFeature

Defined in: core/features/pagination.svelte.ts:45

Manages pagination functionality within the data grid, including page navigation, size adjustments, and event handling.

Type Parameters

TOriginalRow = any

Implements

Constructors

new PaginationFeature()

new PaginationFeature<TOriginalRow>(datagrid, config?): PaginationFeature<TOriginalRow>

Defined in: core/features/pagination.svelte.ts:78

Creates an instance of the PaginationFeature class.

Parameters

datagrid

DatagridCore<TOriginalRow>

The data grid instance to which pagination will be applied.

config?

Partial

Optional configuration to initialize the feature.

Returns

PaginationFeature<TOriginalRow>

Properties

PropertyTypeDescriptionDefined in
autoResetPagebooleanFlag indicating whether page resets automatically.core/features/pagination.svelte.ts:50
datagridDatagridCore<TOriginalRow>The instance of the data grid associated with this feature.core/features/pagination.svelte.ts:47
manualbooleanFlag indicating whether pagination is manual.core/features/pagination.svelte.ts:56
onPaginationChange(config: PaginationFeature<any>) => voidCallback function to handle changes in pagination state.core/features/pagination.svelte.ts:53
pageanyThe current page number (starts at 1).core/features/pagination.svelte.ts:59
pageCountnumberTotal number of pages available.core/features/pagination.svelte.ts:68
pageSizeanyThe number of rows per page (default is 10).core/features/pagination.svelte.ts:62
pageSizesanyAvailable options for rows per page (e.g., [10, 20, 50, 100]).core/features/pagination.svelte.ts:65
totalCountnumberTotal count of rows across all pages.core/features/pagination.svelte.ts:71

Methods

canGoToNextPage()

canGoToNextPage(): boolean

Defined in: core/features/pagination.svelte.ts:95

Determines if the next page can be navigated to.

Returns

boolean

true if the current page is equal to the last page, meaning no next page exists.


canGoToPrevPage()

canGoToPrevPage(): boolean

Defined in: core/features/pagination.svelte.ts:87

Determines if the previous page can be navigated to.

Returns

boolean

true if the current page is 1, meaning no previous page exists.


getPageCount()

getPageCount(data): number

Defined in: core/features/pagination.svelte.ts:164

Calculates the total number of pages based on the current data set and page size.

Parameters

data

any[]

The dataset used for pagination calculation.

Returns

number

The total number of pages.


goToClosestPage()

goToClosestPage(): void

Defined in: core/features/pagination.svelte.ts:153

Navigates to the closest valid page, ensuring it’s within the range of available pages.

Returns

void


goToFirstPage()

goToFirstPage(): void

Defined in: core/features/pagination.svelte.ts:135

Navigates to the first page.

Returns

void


goToLastPage()

goToLastPage(): void

Defined in: core/features/pagination.svelte.ts:144

Navigates to the last page.

Returns

void


goToNextPage()

goToNextPage(): void

Defined in: core/features/pagination.svelte.ts:115

Navigates to the next page, if possible.

Returns

void


goToPage()

goToPage(newPage): void

Defined in: core/features/pagination.svelte.ts:103

Navigates to a specific page.

Parameters

newPage

number

The page number to navigate to.

Returns

void


goToPrevPage()

goToPrevPage(): void

Defined in: core/features/pagination.svelte.ts:125

Navigates to the previous page, if possible.

Returns

void


setPageSize()

setPageSize(newSize): void

Defined in: core/features/pagination.svelte.ts:172

Updates the page size and adjusts pagination accordingly.

Parameters

newSize

number

The new page size to set.

Returns

void