Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
add callback for when search term updated
Browse files Browse the repository at this point in the history
Summary: this will be used by the bloks debugger to detect changes in the filters

Reviewed By: mweststrate

Differential Revision: D65426852

fbshipit-source-id: 80d5538a19f52eaf54e808e2fbbe03bbd2d6e046
  • Loading branch information
Luke De Feo authored and facebook-github-bot committed Nov 5, 2024
1 parent 10a4f0e commit c78fa8c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ type DataTableBaseProps<T = any> = {
| null
| ((dataView?: DataSourceView<T, T[keyof T]>) => React.ReactElement);
powerSearchInitialState?: SearchExpressionTerm[];
onSearchExpressionChange?: (searchExpression: SearchExpressionTerm[]) => void;
/**
* Adds a special power search entry to search through the entire row (mathching a substring in it after stringifying it as a JSON)
* @default true
Expand Down Expand Up @@ -255,6 +256,10 @@ export function DataTable<T extends object>(
useAssertStableRef(dataSource, 'dataSource');
useAssertStableRef(onRowStyle, 'onRowStyle');
useAssertStableRef(props.onSelect, 'onRowSelect');
useAssertStableRef(
props.onSearchExpressionChange,
'onSearchExpressionChanges',
);
useAssertStableRef(props.columns, 'columns');
useAssertStableRef(onCopyRows, 'onCopyRows');
useAssertStableRef(onContextMenu, 'onContextMenu');
Expand Down Expand Up @@ -929,6 +934,7 @@ export function DataTable<T extends object>(
searchExpression={searchExpression}
onSearchExpressionChange={(newSearchExpression) => {
tableManager.setSearchExpression(newSearchExpression);
props.onSearchExpressionChange?.(newSearchExpression);
}}
onConfirmUnknownOption={
props.enablePowerSearchWholeRowSearch
Expand Down

0 comments on commit c78fa8c

Please sign in to comment.