Skip to content

Documentation - Working Indicator directive

As the calculation of the new displayed list may be long, smart table will notify the current processing state (whether the calculation is taking place). This directive allows you to listen to changes in the processing state

import {smartTable, workingIndicatorDirective as workingIndicator} from 'smart-table-core';

const data = [
    {surname: 'Deubaze', name: 'Raymond'},
    {surname: 'Foo', name: 'Bar'},
    {surname: 'Doe', name: 'John'}
];

const smartCollection = smartTable({data});

const directive = workingIndicator({table: smartCollection});

directive.onExecutionChange(({working}) => {
    if (working === true) {
        console.time('exec');
    } else {
        console.timeEnd('exec');
    }
});

smartCollection.exec();
See in CodePen

Factory

Arguments

The factory takes as argument an options object with the following properties

table
An instance of smart table

Instance API

.onExecutionChange

Register an event listener to the EXEC_CHANGED event (triggered whenever the processing state changes)

Arguments

listener
A function whose unique argument will be an object with the structure {working:true} where the values of the working property tells whether the table is processing or not.