Skip to content

Commit 889bfeb

Browse files
committed
another row model refactor
1 parent 401d69b commit 889bfeb

File tree

86 files changed

+799
-995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+799
-995
lines changed

docs/api/features/pagination.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ getPageCount: () => number
190190
191191
Returns the page count. If manually paginating or controlling the pagination state, this will come directly from the `options.pageCount` table option, otherwise it will be calculated from the table data using the total row count and current page size.
192192
193-
### `getPrePaginationRowModel`
193+
### `getPrePaginatedRowModel`
194194
195195
```tsx
196-
getPrePaginationRowModel: () => RowModel<TFeatures, TData>
196+
getPrePaginatedRowModel: () => RowModel<TFeatures, TData>
197197
```
198198
199199
Returns the row model for the table before any pagination has been applied.

docs/guide/pagination.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const table = useTable({
6363

6464
If you decide that you need to use server-side pagination, here is how you can implement it.
6565

66-
No pagination row model is needed for server-side pagination, but if you have provided it for other tables that do need it in a shared component, you can still turn off the client-side pagination by setting the `manualPagination` option to `true`. Setting the `manualPagination` option to `true` will tell the table instance to use the `table.getPrePaginationRowModel` row model under the hood, and it will make the table instance assume that the `data` that you pass in is already paginated.
66+
No pagination row model is needed for server-side pagination, but if you have provided it for other tables that do need it in a shared component, you can still turn off the client-side pagination by setting the `manualPagination` option to `true`. Setting the `manualPagination` option to `true` will tell the table instance to use the `table.getPrePaginatedRowModel` row model under the hood, and it will make the table instance assume that the `data` that you pass in is already paginated.
6767

6868
#### Page Count and Row Count
6969

docs/guide/row-models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ For normal rendering use cases, you will probably only need to use the `table.ge
8888
- `getPreExpandedRowModel` - returns a row model that only includes root level rows with no expanded sub-rows included. Still includes sorting.
8989
9090
- `getPaginatedRowModel` - returns a row model that only includes the rows that should be displayed on the current page based on the pagination state.
91-
- `getPrePaginationRowModel` - returns a row model without pagination applied (includes all rows).
91+
- `getPrePaginatedRowModel` - returns a row model without pagination applied (includes all rows).
9292
9393
- `getSelectedRowModel` - returns a row model of all selected rows (but only based on the data that was passed to the table). Runs after getCoreRowModel.
9494
- `getPreSelectedRowModel` - returns a row model before row selection is applied (Just returns getCoreRowModel).

examples/angular/filters/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
}
123123
</select>
124124
</div>
125-
<div>{{ table.getPrePaginationRowModel().rows.length }} Rows</div>
125+
<div>{{ table.getPrePaginatedRowModel().rows.length }} Rows</div>
126126
<div>
127127
<button class="border rounded p-2 mb-2" (click)="refreshData()">
128128
Refresh Data

examples/qwik/filters/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ const App = component$(() => {
263263
})}
264264
</tbody>
265265
</table>
266-
<div>{table.getPrePaginationRowModel().rows.length} Rows</div>
266+
<div>{table.getPrePaginatedRowModel().rows.length} Rows</div>
267267
<pre>{JSON.stringify(table.getState(), null, 2)}</pre>
268268
</div>
269269
)

examples/react/custom-features/src/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ function App() {
171171
const table = useTable({
172172
_features: { DensityFeature }, // pass our custom feature to the table to be instantiated upon creation
173173
_rowModels: {
174-
Filtered: createFilteredRowModel(),
175-
Paginated: createPaginatedRowModel(),
176-
Sorted: createSortedRowModel(),
174+
filteredRowModel: createFilteredRowModel(),
175+
paginatedRowModel: createPaginatedRowModel(),
176+
sortedRowModel: createSortedRowModel(),
177177
},
178178
columns,
179179
data,

examples/react/editable-data/src/main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const _features = tableFeatures({ RowPagination, ColumnFiltering })
2626
const options = tableOptions<typeof _features, Person>({
2727
_features,
2828
_rowModels: {
29-
Filtered: createFilteredRowModel(),
30-
Paginated: createPaginatedRowModel(),
29+
filteredRowModel: createFilteredRowModel(),
30+
paginatedRowModel: createPaginatedRowModel(),
3131
},
3232
})
3333

examples/react/expanding/src/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ function App() {
130130
const table = useTable({
131131
_features,
132132
_rowModels: {
133-
Filtered: createFilteredRowModel(),
134-
Paginated: createPaginatedRowModel(),
135-
Sorted: createSortedRowModel(),
133+
filteredRowModel: createFilteredRowModel(),
134+
paginatedRowModel: createPaginatedRowModel(),
135+
sortedRowModel: createSortedRowModel(),
136136
},
137137
columns,
138138
data,

examples/react/filters-faceted/src/main.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ function App() {
107107
sortingFns,
108108
},
109109
_rowModels: {
110-
Filtered: createFilteredRowModel(), // client-side filtering
111-
Paginated: createPaginatedRowModel(),
112-
Sorted: createSortedRowModel(),
113-
Faceted: createFacetedRowModel(), // client-side faceting
114-
FacetedMinMax: createFacetedMinMaxValues(), // generate min/max values for range filter
115-
FacetedUnique: createFacetedUniqueValues(), // generate unique values for select filter/autocomplete
110+
filteredRowModel: createFilteredRowModel(), // client-side filtering
111+
paginatedRowModel: createPaginatedRowModel(),
112+
sortedRowModel: createSortedRowModel(),
113+
facetedRowModel: createFacetedRowModel(), // client-side faceting
114+
facetedMinMaxValues: createFacetedMinMaxValues(), // generate min/max values for range filter
115+
facetedUniqueValues: createFacetedUniqueValues(), // generate unique values for select filter/autocomplete
116116
},
117117
columns,
118118
data,
@@ -247,7 +247,7 @@ function App() {
247247
))}
248248
</select>
249249
</div>
250-
<div>{table.getPrePaginationRowModel().rows.length} Rows</div>
250+
<div>{table.getPrePaginatedRowModel().rows.length} Rows</div>
251251
<div>
252252
<button onClick={rerender}>Force Rerender</button>
253253
</div>

examples/react/filters-fuzzy/src/main.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ function App() {
133133
filterFns,
134134
},
135135
_rowModels: {
136-
Filtered: createFilteredRowModel(),
137-
Paginated: createPaginatedRowModel(),
138-
Sorted: createSortedRowModel(),
136+
filteredRowModel: createFilteredRowModel(),
137+
paginatedRowModel: createPaginatedRowModel(),
138+
sortedRowModel: createSortedRowModel(),
139139
},
140140
columns,
141141
data,
@@ -294,7 +294,7 @@ function App() {
294294
))}
295295
</select>
296296
</div>
297-
<div>{table.getPrePaginationRowModel().rows.length} Rows</div>
297+
<div>{table.getPrePaginatedRowModel().rows.length} Rows</div>
298298
<div>
299299
<button onClick={() => rerender()}>Force Rerender</button>
300300
</div>

0 commit comments

Comments
 (0)