getRowIds
The getRowIds
method returns the Ids
of every Row
in a given Table
.
getRowIds(tableId: string): Ids
Type | Description | |
---|---|---|
tableId | string | |
returns | Ids | An array of the Ids of every Row in the Table. |
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. Although the order of Ids
have no meaning, this method is expected to return them in the order in which each Row
was added.
Examples
This example retrieves the Row
Ids
in a Table
.
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.
const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
console.log(store.getRowIds('employees'));
// -> []