TinyBase logoTinyBase β

getCellIds

The getCellIds method returns the Ids of every Cell in a given Row in a given Table.

getCellIds(
  tableId: string,
  rowId: string,
): Ids
TypeDescription
tableIdstring

The Id of the Table in the Store.

rowIdstring

The Id of the Row in the Table.

returnsIds

An array of the Ids of every Cell in the Row.

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 in a Row.

import {createStore} from 'tinybase';

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

This example retrieves the Cell Ids of a Row that does not exist, returning an empty array.

import {createStore} from 'tinybase';

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

Since

v1.0.0