src/js/table/TableStore.js
function(data) {
        this.data = _.values(_.cloneDeep(data));

        // Run data through definition formatter if it exists.
        if (this.dataFormatter) {
            this.data = this.dataFormatter(data);
        }

        this.dataCount = this.data.length;

        var formatPercent = (col, item) => {
            // Set any null or undefined percent values to 0.
            if (item[col.dataProperty] === null || typeof item[col.dataProperty] === 'undefined') {
                item[col.dataProperty] = 0;
            }
            // Provide formatted value in different field.
            item[`${col.dataProperty}Percent`] = item[col.dataProperty] + '%';
        };

        var formatTimeStatus = (col, item) => {
            if (col.dataType === 'status' && item[col.dataProperty]) {
                item.online = moment(item[col.dataProperty]).valueOf() > moment(Date.now()).subtract(col.onlineLimit, 'minutes').valueOf();
            }

            item[col.dataProperty] = item[col.dataProperty] || null;
            // Provide formatted value in different field.
            item[`${col.dataProperty}Timestamp`] = item[col.dataProperty]
                ? (typeof col.timeFormat === 'function' ? col.timeFormat(item[col.dataProperty]) : moment(item[col.dataProperty]).format(col.timeFormat))
                : '--';
        };

        var formatDuration = (col, item) => {
            // Set any null or undefined duration values to 0.
            if (item[col.dataProperty] === null || typeof item[col.dataProperty] === 'undefined') {
                item[col.dataProperty] = 0;
            }
            // Format the duration, e.g. '2d 0h 5m', '40m'.
            var formattedDuration = (value, limit) => {
                var times = [
                        // Use `asDays` instead of `days` since we are not looking at longer segments of time (i.e. years and months).
                        {time: 'days', formatter: 'asDays', suffix: 'd'},
                        {time: 'hours', formatter: 'hours', suffix: 'h'},
                        {time: 'minutes', formatter: 'minutes', suffix: 'm'},
                        {time: 'seconds', formatter: 'seconds', suffix: 's'},
                        {time: 'milliseconds', formatter: 'milliseconds', suffix: 'ms'}
                    ],
                    indexOfTime = _.findIndex(times, {time: limit});
                if (indexOfTime !== -1) {
                    times = times.slice(0, indexOfTime + 1);
                }
                return _.reduce(times, (formattedValue, currentTime) => {
                    var currentTimeValue = Math.floor(value[currentTime.formatter]());
                    // Do not return a zero value for the current time if it would be the first value in the result.
                    if (currentTimeValue === 0 && formattedValue.length === 0) {
                        return '';
                    }
                    return `${formattedValue} ${currentTimeValue}${currentTime.suffix}`;
                }, '').trim();
            };

            // Provide formatted value in different field.
            item[`${col.dataProperty}Duration`] = formattedDuration(moment.duration(item[col.dataProperty]), col.durationFormat || 'minutes');
        };

        // Run data through built in data formatters.
        _.forEach(this.cols, function(col) {
            // store the original passed in sort direction
            col.defaultSortDirection = col.sortDirection;
            // Default to 15 minutes if the onlineLimit for the col was not set or was set incorrectly.
            if (col.dataType === 'status' && (typeof col.onlineLimit !== 'number' || col.onlineLimit < 1)) {
                col.onlineLimit = 15;
            }
            _.forEach(this.data, function(item) {
                if (col.dataType === 'percent') {
                    formatPercent(col, item);
                }
                else if (col.dataType === 'time' || col.dataType === 'status') {
                    formatTimeStatus(col, item);
                }
                else if (col.dataType === 'duration') {
                    formatDuration(col, item);
                }
            });
        }, this);

        this.selectedItems = {};
        //Reset the filter value on data change to clear any filtered state. Anytime new data comes in we want to clear all quick filters
        //that might applied and show the full result set.
        this.filterValue = '';

        if (typeof this.sortColIndex === 'number') {
            this.sortData(this.sortColIndex, this.cols[this.sortColIndex].sortDirection);
        }
    }
function(data) {
        this.data = _.values(_.cloneDeep(data));

        // Run data through definition formatter if it exists.
        if (this.dataFormatter) {
            this.data = this.dataFormatter(data);
        }

        this.dataCount = this.data.length;

        var formatPercent = (col, item) => {
            // Set any null or undefined percent values to 0.
            if (item[col.dataProperty] === null || typeof item[col.dataProperty] === 'undefined') {
                item[col.dataProperty] = 0;
            }
            // Provide formatted value in different field.
            item[`${col.dataProperty}Percent`] = item[col.dataProperty] + '%';
        };

        var formatTimeStatus = (col, item) => {
            if (col.dataType === 'status' && item[col.dataProperty]) {
                item.online = moment(item[col.dataProperty]).valueOf() > moment(Date.now()).subtract(col.onlineLimit, 'minutes').valueOf();
            }

            item[col.dataProperty] = item[col.dataProperty] || null;
            // Provide formatted value in different field.
            item[`${col.dataProperty}Timestamp`] = item[col.dataProperty]
                ? (typeof col.timeFormat === 'function' ? col.timeFormat(item[col.dataProperty]) : moment(item[col.dataProperty]).format(col.timeFormat))
                : '--';
        };

        var formatDuration = (col, item) => {
            // Set any null or undefined duration values to 0.
            if (item[col.dataProperty] === null || typeof item[col.dataProperty] === 'undefined') {
                item[col.dataProperty] = 0;
            }
            // Format the duration, e.g. '2d 0h 5m', '40m'.
            var formattedDuration = (value, limit) => {
                var times = [
                        // Use `asDays` instead of `days` since we are not looking at longer segments of time (i.e. years and months).
                        {time: 'days', formatter: 'asDays', suffix: 'd'},
                        {time: 'hours', formatter: 'hours', suffix: 'h'},
                        {time: 'minutes', formatter: 'minutes', suffix: 'm'},
                        {time: 'seconds', formatter: 'seconds', suffix: 's'},
                        {time: 'milliseconds', formatter: 'milliseconds', suffix: 'ms'}
                    ],
                    indexOfTime = _.findIndex(times, {time: limit});
                if (indexOfTime !== -1) {
                    times = times.slice(0, indexOfTime + 1);
                }
                return _.reduce(times, (formattedValue, currentTime) => {
                    var currentTimeValue = Math.floor(value[currentTime.formatter]());
                    // Do not return a zero value for the current time if it would be the first value in the result.
                    if (currentTimeValue === 0 && formattedValue.length === 0) {
                        return '';
                    }
                    return `${formattedValue} ${currentTimeValue}${currentTime.suffix}`;
                }, '').trim();
            };

            // Provide formatted value in different field.
            item[`${col.dataProperty}Duration`] = formattedDuration(moment.duration(item[col.dataProperty]), col.durationFormat || 'minutes');
        };

        // Run data through built in data formatters.
        _.forEach(this.cols, function(col) {
            // store the original passed in sort direction
            col.defaultSortDirection = col.sortDirection;
            // Default to 15 minutes if the onlineLimit for the col was not set or was set incorrectly.
            if (col.dataType === 'status' && (typeof col.onlineLimit !== 'number' || col.onlineLimit < 1)) {
                col.onlineLimit = 15;
            }
            _.forEach(this.data, function(item) {
                if (col.dataType === 'percent') {
                    formatPercent(col, item);
                }
                else if (col.dataType === 'time' || col.dataType === 'status') {
                    formatTimeStatus(col, item);
                }
                else if (col.dataType === 'duration') {
                    formatDuration(col, item);
                }
            });
        }, this);

        this.selectedItems = {};
        //Reset the filter value on data change to clear any filtered state. Anytime new data comes in we want to clear all quick filters
        //that might applied and show the full result set.
        this.filterValue = '';

        if (typeof this.sortColIndex === 'number') {
            this.sortData(this.sortColIndex, this.cols[this.sortColIndex].sortDirection);
        }
    }
Triggered when data is received correctly from the server.
@param {Object} data - The data retrieved from the server for the Table instance.