diff --git a/src/selectors.js b/src/selectors.js index f6ef362..3ad954b 100644 --- a/src/selectors.js +++ b/src/selectors.js @@ -89,12 +89,20 @@ export default (tableName) => { getColumns, (initialData, columns) => { const options = []; - const values = {}; const columnMap = _.keyBy(columns, 'key'); + const values = {}; + + // set predefined values + columns.forEach(column => { + if (column.taggable && column.values) { + values[column.key] = column.values; + } + }); + // collect values for columns that don't have predefined values initialData.forEach(row => { columns.forEach(column => { - if (!column.taggable) { + if (!column.taggable || column.values) { return; } if (!values[column.key]) { diff --git a/stories/UsersTable.js b/stories/UsersTable.js index dbc8514..ea3c6ea 100644 --- a/stories/UsersTable.js +++ b/stories/UsersTable.js @@ -11,6 +11,11 @@ const columns = [ key: 'status', header: 'Status', taggable: true, + values: [ + 'UNKNOWN', + 'ACTIVE', + 'DISABLED', + ], getValueTitle: (value) => ({ UNKNOWN: 'Gone missing users', ACTIVE: 'Active users',