Pagination with usePaging
Set up paging for dynamic data objects with usePaging
Use usePaging from @olenbetong/appframe-react to wire a pagination component to a dynamic DataObject.
Configure the DataObject
The data object must enable dynamic loading and define a maxRecords page size:
export const dsLocations = af.data.generateApiDataObject<LocationsRecord>({
resource: "aviw_Fleet_Locations",
id: "dsLocations",
allowUpdate: false,
allowInsert: false,
allowDelete: true,
dynamicLoading: true,
fields: [/* ... */],
parameters: {
maxRecords: 50,
sortOrder: [{ LocationID: af.data.SortOrder.Asc }],
},
});Hook up paging in a component
Total counts and page changes
usePaging returns the current page and page count. Use changePage to move between pages:
To show the total number of records across all pages, read the totalCount parameter:
Combine this with useDataLength to display how many rows are on the current page.
Last updated
Was this helpful?