Does the Clarity datagrid trust an external total count, or must the application clamp page requests when the backend bounds rows?
0 reputation · 26 Sept 2023, 22:48 UTC
Binding an Angular Clarity datagrid to a large remote table raises a boundary question: the backend query bounds the returned rows with LIMIT and OFFSET, while the datagrid renders page controls. The unresolved decision is ownership of the total page count. The grid can be fed only the current page slice plus an explicit total count, or it can attempt to derive pagination boundaries from the rows currently bound. These two approaches disagree when the last-page control or page-size selector is used.
A related uncertainty appears after changing page size or applying a filter. The emitted page index may still reflect the previous page size, which can produce an out-of-range offset unless the application clamps the request. Because datagrid pagination and state APIs have changed across Clarity major releases, the exact contract is version-sensitive.
Does the datagrid treat an externally supplied total count as authoritative for last-page and page-size calculations? When page size changes or a filter is applied, does the grid re-emit a corrected page index, or must the application clamp the offset before issuing the next query? Which Clarity major version defines the current server-driven pagination state contract?