getRowIds
The getRowIds
method returns the Ids
of every Row
in a given Table
.
getRowIds(tableId: string): Ids
Type | Description | |
---|---|---|
tableId | string | |
returns | Ids |
Note that this returns a copy of, rather than a reference, to the list of Ids
, so changes made to the list are not made to the Store
itself.
Examples
This example retrieves the Row
Ids
in a Table
.
import {createStore} from 'tinybase';
const store = createStore().setTables({
pets: {
fido: {species: 'dog'},
felix: {species: 'cat'},
},
});
console.log(store.getRowIds('pets'));
// -> ['fido', 'felix']
This example retrieves the Row
Ids
of a Table
that does not exist, returning an empty array.
import {createStore} from 'tinybase';
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
console.log(store.getRowIds('employees'));
// -> []
Since
v1.0.0