@@ -17,6 +17,7 @@ import { useVirtualizer, Virtualizer } from "@tanstack/react-virtual";
1717import { useRef } from "react" ;
1818import { TableBody } from "./TableBody" ;
1919import { useVirtualizationTableHeight } from "../hooks/useVirtualizationTableHeight" ;
20+ import Skeleton from "react-loading-skeleton" ;
2021
2122interface TableInternalProps < TData , TFilter extends FilterModel = Record < string , never > > extends ReactDataTableProps < TData , TFilter > {
2223 virtualizer ?: Virtualizer < HTMLDivElement , Element > ;
@@ -272,6 +273,8 @@ const ReactDataTable = <TData, TFilter extends FilterModel = Record<string, neve
272273 totalRecords = table . getCoreRowModel ( ) . rows . length ,
273274 dragAndDropOptions,
274275 pagingNavigationComponents,
276+ isLoading,
277+ isFetching,
275278 onPseudoHeightChange,
276279 } = props ;
277280
@@ -326,24 +329,30 @@ const ReactDataTable = <TData, TFilter extends FilterModel = Record<string, neve
326329 </ DndContext >
327330
328331 { showPaging && (
329- < Paging
330- currentItemsPerPage = { pagination . pageSize }
331- currentPage = { pagination . pageIndex + 1 }
332- totalRecords = { totalRecords }
333- currentRecordCount = { table . getRowModel ( ) . rows . length }
334- setItemsPerPage = { ( x ) => {
335- table . setPageSize ( x ) ;
336- } }
337- setCurrentPage = { ( x ) => table . setPageIndex ( x - 1 ) }
338- possiblePageItemCounts = { pageSizes }
339- translations = { {
340- itemsPerPageDropdown : reactDataTableTranslations . itemsPerPageDropdown ,
341- showedItemsText : reactDataTableTranslations . showedItemsText ,
342- } }
343- pagingPossible = { true }
344- changePageSizePossible = { ! hidePageSizeChange }
345- navigationComponents = { pagingNavigationComponents }
346- />
332+ < >
333+ { isLoading || isFetching ? (
334+ < Skeleton count = { 1 } height = { 20 } />
335+ ) : (
336+ < Paging
337+ currentItemsPerPage = { pagination . pageSize }
338+ currentPage = { pagination . pageIndex + 1 }
339+ totalRecords = { totalRecords }
340+ currentRecordCount = { table . getRowModel ( ) . rows . length }
341+ setItemsPerPage = { ( x ) => {
342+ table . setPageSize ( x ) ;
343+ } }
344+ setCurrentPage = { ( x ) => table . setPageIndex ( x - 1 ) }
345+ possiblePageItemCounts = { pageSizes }
346+ translations = { {
347+ itemsPerPageDropdown : reactDataTableTranslations . itemsPerPageDropdown ,
348+ showedItemsText : reactDataTableTranslations . showedItemsText ,
349+ } }
350+ pagingPossible = { true }
351+ changePageSizePossible = { ! hidePageSizeChange }
352+ navigationComponents = { pagingNavigationComponents }
353+ />
354+ ) }
355+ </ >
347356 ) }
348357 </ >
349358 ) ;
0 commit comments