Events
Store's event hooks.
onCellChange
The onCellChange
event hook registers a listener function with a Store that will be called whenever data in a Cell changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useCell composable).
You can either listen to a single Cell (by specifying the Table Id, Row Id, and Cell Id as the first three parameters) or changes to any Cell (by providing null
wildcards).
All, some, or none of the tableId
, rowId
, and cellId
parameters can be wildcarded with null. You can listen to a specific Cell in a specific Row in a specific Table, any Cell in any Row in any Table, for example - or every other combination of wildcards.
Unlike the addCellListener method, which returns a listener Id and requires you to remove it manually, the onCellChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.rowId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Row to listen to, ornull
as a wildcard.cellId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Cell to listen to, ornull
as a wildcard.listener
(CellListener
): The function that will be called whenever data in the Cell changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
) An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onCellChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onCellIdsChange
The onCellIdsChange
event hook registers a listener function with a Store that will be called whenever the Cell Ids in a Row change.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useCellIds composable).
You can either listen to a single Row (by specifying the Table Id and Row Id as the first two parameters) or changes to any Row (by providing null
wildcards).
Both, either, or neither of the tableId
and rowId
parameters can be wildcarded with null
. You can listen to a specific Row in a specific Table, any Row in a specific Table, a specific Row in any Table, or any Row in any Table.
Unlike the addCellIdsListener method, which returns a listener Id and requires you to remove it manually, the onCellIdsChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.rowId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Row to listen to, ornull
as a wildcard.listener
(CellIdsListener
): The function that will be called whenever the Cell Ids in a Row change.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
) An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onCellIdsChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onDidFinishTransaction
The onDidFinishTransaction
event hook registers a listener function with a Store that will be called just after other non-mutating listeners are called at the end of the transaction.
Unlike the addDidFinishTransactionListener method, which returns a listener Id and requires you to remove it manually, the onDidFinishTransaction
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(DidFinishTransactionListener
): The function that will be called just after other non-mutating listeners are called at the end of the transaction.options
? (UseListenerOptions
): Options for the listener.
Returns
The same as the useListener
composable.
Example
This example uses the onDidFinishTransaction
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasCellChange
The onHasCellChange
event hook registers a listener function with a Store that will be called when a Cell is added to or removed from the Store.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the existence of a cell (which is more easily done with the useHasCell composable).
You can either listen to a single Cell being added or removed (by specifying the Table Id, Row Id, and Cell Id as the first three parameters) or changes to any Cell (by providing null
wildcards).
All, some, or none of the tableId
, rowId
, and cellId
parameters can be wildcarded with null
. You can listen to a specific Cell in a specific Row in a specific Table, any Cell in any Row in any Table, for example - or every other combination of wildcards.
Unlike the addHasCellListener method, which returns a listener Id and requires you to remove it manually, the onHasCellChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.rowId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Row to listen to, ornull
as a wildcard.cellId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Cell to listen to, ornull
as a wildcard.listener
(HasCellListener
): The function that will be called whenever the matching Cell is added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
) An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasCellChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasRowChange
The onHasRowChange
event hook registers a listener function with a Store that will be called when a Row is added to or removed from the Store.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useHasRow composable).
You can either listen to a single Row being added or removed (by specifying the Table Id and Row Id as the first two parameters) or changes to any Row (by providing null
wildcards).
All, some, or none of the tableId
and rowId
parameters can be wildcarded with null
. You can listen to a specific Row in a specific Table, any Row in a specific Table, a specific Row in any Table, or any Row in any Table.
Unlike the addHasRowListener method, which returns a listener Id and requires you to remove it manually, the onHasRowChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.rowId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Row to listen to, ornull
as a wildcard.listener
(HasRowListener
): The function that will be called whenever the matching Row is added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasRowChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasTableCellChange
The onHasTableCellChange
event hook registers a listener function with a Store that will be called when a Cell is added to or removed from anywhere in a Table as a whole.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useHasTableCell composable).
You can either listen to a single Cell being added or removed (by specifying the Table Id and Cell Id as the first two parameters) or changes to any Cell (by providing null
wildcards).
All, some, or none of the tableId
and cellId
parameters can be wildcarded with null
. You can listen to a specific Cell in a specific Table, any Cell in a specific Table, a specific Cell in any Table, or any Cell in any Table.
Unlike the addHasTableCellListener method, which returns a listener Id and requires you to remove it manually, the onHasTableCellChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.cellId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Cell to listen to, ornull
as a wildcard.listener
(HasTableCellListener
): The function that will be called whenever the matching Cell is added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasTableCellChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasTableChange
The onHasTableChange
event hook registers a listener function with a Store that will be called when a Table is added to or removed from the Store.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useHasTable composable).
You can either listen to a single Table being added or removed (by specifying the Table Id as the first parameter) or changes to any Table (by providing a null
wildcard).
All, some, or none of the tableId
parameters can be wildcarded with null
. You can listen to a specific Table, any Table, or every other combination of wildcards.
Unlike the addHasTableListener method, which returns a listener Id and requires you to remove it manually, the onHasTableChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.listener
(HasTableListener
): The function that will be called whenever the matching Table is added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasTableChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasTablesChange
The onHasTablesChange
event hook registers a listener function with a Store that will be called when Tables as a whole are added to or removed from the Store.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useHasTables composable).
Unlike the addHasTablesListener method, which returns a listener Id and requires you to remove it manually, the onHasTablesChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(HasTablesListener
): The function that will be called whenever Tables as a whole are added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasTablesChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasValueChange
The onHasValueChange
event hook registers a listener function with a Store that will be called when a Value is added to or removed from the Store.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useHasValue composable).
You can either listen to a single Value being added or removed (by specifying the Value Id) or any Value being added or removed (by providing a null
wildcard).
Unlike the addHasValueListener method, which returns a listener Id and requires you to remove it manually, the onHasValueChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
valueId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Value to listen to, ornull
as a wildcard.listener
(HasValueListener
): The function that will be called whenever the matching Value is added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasValueChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onHasValuesChange
The onHasValuesChange
event hook registers a listener function with a Store that will be called when Values as a whole are added to or removed from the Store.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the values (which is more easily done with the useHasValues composable).
Unlike the addHasValuesListener method, which returns a listener Id and requires you to remove it manually, the onHasValuesChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(HasValuesListener
): The function that will be called whenever Values as a whole are added or removed.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onHasValuesChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onRowChange
The onRowChange
event hook registers a listener function with a Store that will be called whenever data in a Row changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the row value (which is more easily done with the useRow composable).
Unlike the addRowListener method, which returns a listener Id and requires you to remove it manually, the onRowChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.rowId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Row to listen to, ornull
as a wildcard.listener
(RowListener
): The function that will be called whenever data in the Row changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onRowChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onRowCountChange
The onRowCountChange
event hook registers a listener function with a Store that will be called whenever the count of the Row objects in a Table changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the row count (which is more easily done with the useRowCount composable).
Unlike the addRowCountListener method, which returns a listener Id and requires you to remove it manually, the onRowCountChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.listener
(RowCountListener
): The function that will be called whenever the count of the Row objects in the Table changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onRowCountChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onRowIdsChange
The onRowIdsChange
event hook registers a listener function with a Store that will be called whenever the Row Ids in a Table change.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the row Ids (which is more easily done with the useRowIds composable).
Unlike the addRowIdsListener method, which returns a listener Id and requires you to remove it manually, the onRowIdsChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.listener
(RowIdsListener
): The function that will be called whenever the Row Ids in the Table change.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onRowIdsChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onSortedRowIdsChange
The onSortedRowIdsChange
event hook registers a listener function with a Store that will be called whenever sorted (and optionally, paginated) Row Ids in a Table change.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the sorted row IDs (which is more easily done with the useSortedRowIds composable).
Unlike the addSortedRowIdsListener method, which returns a listener Id and requires you to remove it manually, the onSortedRowIdsChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<string>
): The Id of the Table in the Store.cellId
(MaybeRefOrGetter
<undefined | string>
): The Id of the Cell whose values are used for sorting, orundefined
to sort by the Row Id itself.descending
(MaybeRefOrGetter
<boolean>
): Whether the sorting should be in descending order.offset
(MaybeRefOrGetter
<number>
): The number of Row Ids to skip for pagination purposes, if any.limit
(MaybeRefOrGetter
<undefined | number>
): The maximum number of Row Ids to return, orundefined
for all.listener
(SortedRowIdsListener
): The function that will be called whenever the sorted Row Ids in the Table change.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onSortedRowIdsChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onStartTransaction
The onStartTransaction
event hook registers a listener function with the Store that will be called at the start of a transaction.
Unlike the addStartTransactionListener method, which returns a listener Id and requires you to remove it manually, the onStartTransaction
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(TransactionListener
): The function that will be called at the start of a transaction.options
? (UseListenerOptions
): Options for the listener.
Returns
The same as the useListener
composable.
Example
This example uses the onStartTransaction
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onTableCellIdsChange
The onTableCellIdsChange
event hook registers a listener function with the Store that will be called whenever the Cell Ids that appear anywhere in a Table change.
Unlike the addTableCellIdsListener method, which returns a listener Id and requires you to remove it manually, the onTableCellIdsChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.listener
(TableCellIdsListener
): The function that will be called whenever the Cell Ids that appear anywhere in a Table change.options
? (UseListenerOptions
): Options for the listener.
Returns
The same as the useListener
composable.
Example
This example uses the onTableCellIdsChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onTableChange
The onTableChange
event hook registers a listener function with a Store that will be called whenever data in a Table changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useTable composable).
You can either listen to a single Table (by specifying its Id as the first parameter) or changes to any Table (by providing a null
wildcard).
Unlike the addTableListener method, which returns a listener Id and requires you to remove it manually, the onTableChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
tableId
(MaybeRefOrGetter
<
IdOrNull
>
): The Id of the Table to listen to, ornull
as a wildcard.listener
(TableListener
): The function that will be called whenever data in the Table changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onTableChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onTableIdsChange
The onTableIdsChange
event hook registers a listener function with a Store that will be called whenever the Table Ids in it change.
Unlike the addTableIdsListener method, which returns a listener Id and requires you to remove it manually, the onTableIdsChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(TableIdsListener
): The function that will be called whenever the Table Ids in the Store change.options
? (UseListenerOptions
): Options for the listener.
Returns
The same as the useListener
composable.
Example
This example uses the onTableIdsChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onTablesChange
The onTablesChange
event hook registers a listener function with a Store that will be called whenever tabular data in it changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useTables composable).
Unlike the addTablesListener method, which returns a listener Id and requires you to remove it manually, the onTablesChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(TablesListener
): The function that will be called whenever tabular data in the Store changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onTablesChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onValueChange
The onValueChange
event hook registers a listener function with a Store that will be called whenever data in a Value changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useValue composable).
You can either listen to a single Value (by specifying its Id as the first parameter) or changes to any Value (by providing a null
wildcard).
Unlike the addValueListener method, which returns a listener Id and requires you to remove it manually, the onValueChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
valueId
(IdOrNull
): The Id of the Value to listen to, ornull
as a wildcard.listener
(ValueListener
): The function that will be called whenever data in the Value changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onValueChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onValueIdsChange
The onValueIdsChange
event hook registers a listener function with a Store that will be called whenever the Value Ids in it change.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useValueIds composable).
Unlike the addValueIdsListener method, which returns a listener Id and requires you to remove it manually, the onValueIdsChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(ValueIdsListener
): The function that will be called whenever the Value Ids in the Store change.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onValueIdsChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onValuesChange
The onValuesChange
event hook registers a listener function with a Store that will be called whenever keyed data in it changes.
This event hook is useful for situations where a component needs to register its own specific listener to do more than simply tracking the value (which is more easily done with the useValues composable).
Unlike the addValuesListener method, which returns a listener Id and requires you to remove it manually, the onValuesChange
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(ValuesListener
): The function that will be called whenever keyed data in the Store changes.options
? (UseListenerOptions
): Options for the listener.mutator
? (MaybeRefOrGetter
<boolean>
): An optional boolean that indicates that the listener mutates Store data.
Returns
The same as the useListener
composable.
Example
This example uses the onValuesChange
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.
onWillFinishTransaction
The onWillFinishTransaction
event hook registers a listener function with the Store that will be called just before other non-mutating listeners are called at the end of the transaction.
Unlike the addWillFinishTransactionListener method, which returns a listener Id and requires you to remove it manually, the onWillFinishTransaction
event hook manages this lifecycle for you: when the component unmounts, the listener on the underlying Store will be deleted.
Parameters
listener
(TransactionListener
): The function that will be called just before other non-mutating listeners are called at the end of the transaction.options
? (UseListenerOptions
): Options for the listener.
Returns
The same as the useListener
composable.
Example
This example uses the onWillFinishTransaction
event hook to create a listener that is scoped to a single component. When the component is unmounted, the listener is removed from the Store.