Allow disabling power search for certain columns
Summary: Doc: https://docs.google.com/document/d/1miofxds9DJgWScj0zFyBbdpRH5Rj0T9FqiCapof5-vU/edit#heading=h.pg8svtdjlx7 Reviewed By: antonk52 Differential Revision: D49373658 fbshipit-source-id: 872bd6ecdce9c3ed7934f86f1954efdff76185b9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c75c377818
commit
3b75b6994b
@@ -124,11 +124,13 @@ export type DataTableColumn<T = any> = {
|
|||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
inversed?: boolean;
|
inversed?: boolean;
|
||||||
sortable?: boolean;
|
sortable?: boolean;
|
||||||
powerSearchConfig?: {
|
powerSearchConfig?:
|
||||||
[K in keyof typeof dataTablePowerSearchOperators]: ReturnType<
|
| {
|
||||||
(typeof dataTablePowerSearchOperators)[K]
|
[K in keyof typeof dataTablePowerSearchOperators]: ReturnType<
|
||||||
>;
|
(typeof dataTablePowerSearchOperators)[K]
|
||||||
};
|
>;
|
||||||
|
}
|
||||||
|
| false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface TableRowRenderContext<T = any> {
|
export interface TableRowRenderContext<T = any> {
|
||||||
@@ -240,6 +242,9 @@ export function DataTable<T extends object>(
|
|||||||
const res: PowerSearchConfig = {fields: {}};
|
const res: PowerSearchConfig = {fields: {}};
|
||||||
|
|
||||||
for (const column of columns) {
|
for (const column of columns) {
|
||||||
|
if (column.powerSearchConfig === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const columnFieldConfig: FieldConfig = {
|
const columnFieldConfig: FieldConfig = {
|
||||||
label: column.title ?? column.key,
|
label: column.title ?? column.key,
|
||||||
key: column.key,
|
key: column.key,
|
||||||
|
|||||||
Reference in New Issue
Block a user