Added support for dotted key paths in Data table column
Summary: This adds support for the key of DataTableColumn to be a dotted path into a nested object, e.g foo.bar. Currently the typescript types only allow a top level key to be set, making this feature currently unusuable from plugin code. While this could be addressed in a future commit the intention of this is to allow the user to add custom fields into their table columns at run time Note there is a side effect to free text search from this commit. Previously it would search all top keys in the object. Now it will only search in columns that are in the table. changelog: Searching data table will now only search columns in the table, rather than all top level attributes of the object Reviewed By: mweststrate Differential Revision: D36663929 fbshipit-source-id: 3688e9f26aa7e1828f8e9ee69f8e6f86268c8a54
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8c4b494d32
commit
e07d5c5bfe
@@ -15,6 +15,7 @@ import {Width} from '../../utils/widthUtils';
|
||||
import {DataFormatter} from '../DataFormatter';
|
||||
import {Dropdown} from 'antd';
|
||||
import {contextMenuTrigger} from '../data-inspector/DataInspectorNode';
|
||||
import {getValueAtPath} from './DataTableManager';
|
||||
|
||||
// heuristic for row estimation, should match any future styling updates
|
||||
export const DEFAULT_ROW_HEIGHT = 24;
|
||||
@@ -159,5 +160,5 @@ export function renderColumnValue<T>(
|
||||
) {
|
||||
return col.onRender
|
||||
? col.onRender(record, highlighted, itemIndex)
|
||||
: DataFormatter.format((record as any)[col.key], col.formatters);
|
||||
: DataFormatter.format(getValueAtPath(record, col.key), col.formatters);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user