TinyBase logoTinyBase β

getTableCellIds

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

getTableCellIds(tableId: string): Ids
TypeDescription
tableIdstring

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.

import {createStore} from 'tinybase';

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.

import {createStore} from 'tinybase';

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

Since

v3.3.0