@@ -68,7 +68,7 @@ export const ServerSidePagination: Story = {
6868
6969 < TableAdapter
7070 data = { data }
71- columns = { columns }
71+ columns = { columns as any }
7272 pageCount = { Math . ceil ( totalRows / pagination . pageSize ) }
7373 manualPagination = { true }
7474 enablePagination = { true }
@@ -84,6 +84,62 @@ export const ServerSidePagination: Story = {
8484 } ,
8585} ;
8686
87+ /**
88+ * A table with server-side pagination (no loader).
89+ */
90+ export const ServerSidePaginationNoLoader : Story = {
91+ render : ( ) => {
92+ const [ data , setData ] = useState < Person [ ] > ( [ ] ) ;
93+ const [ pagination , setPagination ] = useState < PaginationState > ( {
94+ pageIndex : 0 ,
95+ pageSize : 10 ,
96+ } ) ;
97+ const [ totalRows , setTotalRows ] = useState ( 0 ) ;
98+
99+ // Simulate a server-side API call (no loading state)
100+ useEffect ( ( ) => {
101+ // Simulate API delay
102+ const timer = setTimeout ( ( ) => {
103+ const startIndex = pagination . pageIndex * pagination . pageSize ;
104+ const endIndex = startIndex + pagination . pageSize ;
105+ const paginatedData = hugeDataSet . slice ( startIndex , endIndex ) ;
106+
107+ setData ( paginatedData ) ;
108+ setTotalRows ( hugeDataSet . length ) ;
109+ } , 500 ) ;
110+
111+ return ( ) => clearTimeout ( timer ) ;
112+ } , [ pagination . pageIndex , pagination . pageSize ] ) ;
113+
114+ return (
115+ < div className = "w-full max-w-4xl" >
116+ < div className = "bg-gray-50 p-4 mb-4 rounded text-sm" >
117+ < p >
118+ This example demonstrates server-side pagination{ " " }
119+ < b > without any loader</ b > .
120+ </ p >
121+ < p > Current page: { pagination . pageIndex + 1 } </ p >
122+ < p > Page size: { pagination . pageSize } </ p >
123+ < p > Total rows: { totalRows } </ p >
124+ </ div >
125+
126+ < TableAdapter
127+ data = { data }
128+ columns = { columns as any }
129+ pageCount = { Math . ceil ( totalRows / pagination . pageSize ) }
130+ manualPagination = { true }
131+ enablePagination = { true }
132+ pageIndex = { pagination . pageIndex }
133+ pageSize = { pagination . pageSize }
134+ onPaginationChange = { setPagination }
135+ totalRowCount = { totalRows }
136+ className = "w-full"
137+ />
138+ </ div >
139+ ) ;
140+ } ,
141+ } ;
142+
87143/**
88144 * A table with server-side pagination and sorting.
89145 */
@@ -165,7 +221,7 @@ export const ServerSidePaginationAndSorting: Story = {
165221
166222 < TableAdapter
167223 data = { data }
168- columns = { columns }
224+ columns = { columns as any }
169225 pageCount = { Math . ceil ( totalRows / pagination . pageSize ) }
170226 manualPagination = { true }
171227 manualSorting = { true }
@@ -287,7 +343,7 @@ export const ServerSideComplete: Story = {
287343
288344 < TableAdapter
289345 data = { data }
290- columns = { columns }
346+ columns = { columns as any }
291347 pageCount = { Math . ceil ( totalRows / pagination . pageSize ) }
292348 manualPagination = { true }
293349 manualSorting = { true }
0 commit comments