You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `useSortedRowIds` composable returns a **readonly** reference to the sorted (and optionally, paginated) [Ids](https://tinybase.org/api/common/type-aliases/identity/ids/) of every [Row](https://tinybase.org/api/store/type-aliases/store/row/) in a given [Table](https://tinybase.org/api/store/type-aliases/store/table/), and registers a listener so that any changes to that result will cause a re-render.
881
+
882
+
When first accessed, this composable will create a listener so that changes to the sorted [Row](https://tinybase.org/api/store/type-aliases/store/row/)[Ids](https://tinybase.org/api/common/type-aliases/identity/ids/) will cause a re-render. When the component containing this composable is unmounted, the listener will be automatically removed.
883
+
884
+
### Parameters
885
+
886
+
<divclass="hide-default-store">
887
+
888
+
-`store` ([`Store`](https://tinybase.org/api/store/interfaces/store/store/)): The store to listen to.
889
+
890
+
</div>
891
+
892
+
-`tableId` ([`MaybeRefOrGetter`](https://vuejs.org/api/utility-types.html#maybereforgetter)`<string>`): The [Id](https://tinybase.org/api/common/type-aliases/identity/id/) of the [Table](https://tinybase.org/api/store/type-aliases/store/table/) in the [Store](https://tinybase.org/api/store/interfaces/store/store/).
893
+
894
+
-`cellId`<spanclass="blue">?</span> ([`MaybeRefOrGetter`](https://vuejs.org/api/utility-types.html#maybereforgetter)`<string | undefined>`): The [Id](https://tinybase.org/api/common/type-aliases/identity/id/) of the [Cell](https://tinybase.org/api/store/type-aliases/store/cell/) whose values are used for the sorting, or `undefined` to by sort the [Row](https://tinybase.org/api/store/type-aliases/store/row/)[Id](https://tinybase.org/api/common/type-aliases/identity/id/) itself.
895
+
896
+
-`descending`<spanclass="blue">?</span> ([`MaybeRefOrGetter`](https://vuejs.org/api/utility-types.html#maybereforgetter)`<boolean | undefined>`): Whether the sorting should be in descending order.
897
+
898
+
-`offset`<spanclass="blue">?</span> ([`MaybeRefOrGetter`](https://vuejs.org/api/utility-types.html#maybereforgetter)`<number | undefined>`): The number of [Row](https://tinybase.org/api/store/type-aliases/store/row/)[Ids](https://tinybase.org/api/common/type-aliases/identity/ids/) to skip for pagination purposes, if any.
899
+
900
+
-`limit`<spanclass="blue">?</span> ([`MaybeRefOrGetter`](https://vuejs.org/api/utility-types.html#maybereforgetter)`<number | undefined>`): The maximum number of [Row](https://tinybase.org/api/store/type-aliases/store/row/)[Ids](https://tinybase.org/api/common/type-aliases/identity/ids/) to return, or undefined for all.
901
+
902
+
### Returns
903
+
904
+
-`ComputedRef<`[`Ids`](https://tinybase.org/api/common/type-aliases/identity/ids/)`>`: A **readonly** reference to an array of the sorted Ids of every Row in the Table.
905
+
906
+
### Example
907
+
908
+
```ts
909
+
// store
910
+
exportconst store =createStore().setTables({
911
+
pets: {
912
+
fido: { species: 'dog' },
913
+
felix: { species: 'cat' },
914
+
},
915
+
})
916
+
```
917
+
918
+
<divclass="hide-default-store">
919
+
920
+
```vue
921
+
<script setup lang="ts">
922
+
import { useSortedRowIds, injectStore } from 'vue-tinybase/custom-store'
The `useTable` composable returns a **readonly** reference to an object containing the data of a single [Table](https://tinybase.org/api/store/type-aliases/store/table/) in a [Store](https://tinybase.org/api/store/interfaces/store/store/), and registers a listener so that any changes to that result will cause a re-render.
0 commit comments