TinyBase logoTinyBase

delValue

The delValue method lets you remove a single Value from a Store.

delValue(valueId: Id): Store
TypeDescription
valueIdId

The Id of the Value in the Row.

returnsStore

A reference to the Store.

If there is a ValuesSchema applied to the Store and it specifies a default value for this Value Id, then deletion will result in it being set back to its default value.

Examples

This example removes a Value from a Store without a ValuesSchema.

const store = createStore().setValues({open: true, employees: 3});
store.delValue('employees');

console.log(store.getValues());
// -> {open: true}

This example removes a Value from a Store with a ValuesSchema that defaults its value.

const store = createStore()
  .setValues({open: true, employees: 3})
  .setValuesSchema({
    open: {type: 'boolean', default: false},
    employees: {type: 'number'},
  });
store.delValue('open');

console.log(store.getValues());
// -> {open: false, employees: 3}

Since

v3.0.0