TinyBase logoTinyBase

getTableCellIds

The getTableCellIds method returns the Ids of every Cell used across the whole Table.

getTableCellIds(tableId: Id): Ids
TypeDescription
tableIdId

The Id of the Table in the Store.

returnsIds

An array of the Ids of every Cell used across the whole 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.

Examples

This example retrieves the Cell Ids used across a whole Table.

const store = createStore().setTables({
  pets: {
    fido: {species: 'dog', color: 'brown'},
    felix: {species: 'cat', legs: 4},
    cujo: {dangerous: true},
  },
});
console.log(store.getTableCellIds('pets'));
// -> ['species', 'color', 'legs', 'dangerous']

This example retrieves the Cell Ids used across a Table that does not exist, returning an empty array.

const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
console.log(store.getTableCellIds('species'));
// -> []

Since

v3.3.0