-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Add hook useGridPagination to call onGridPage and onGridPageSi…
…ze (#3880)
- Loading branch information
1 parent
c350167
commit 2bc8e32
Showing
3 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/grid/_modules_/grid/hooks/features/pagination/useGridPagination.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useGridPageSize } from './useGridPageSize'; | ||
import { GridApiRef } from '../../../models/api/gridApiRef'; | ||
import { DataGridProcessedProps } from '../../../models/props/DataGridProps'; | ||
import { useGridPage } from './useGridPage'; | ||
|
||
/** | ||
* @requires useGridFilter (state) | ||
* @requires useGridDimensions (event) - can be after | ||
*/ | ||
export const useGridPagination = ( | ||
apiRef: GridApiRef, | ||
props: Pick< | ||
DataGridProcessedProps, | ||
| 'page' | ||
| 'pageSize' | ||
| 'onPageChange' | ||
| 'onPageSizeChange' | ||
| 'autoPageSize' | ||
| 'rowCount' | ||
| 'initialState' | ||
>, | ||
) => { | ||
useGridPageSize(apiRef, props); | ||
useGridPage(apiRef, props); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters