ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
16 lines (13 loc) • 616 B
text/typescript
import { createContext, useContext } from 'react';
import { type Identifier } from '../types';
import { type RowClickFunctionBase } from './types';
export const DataTableCallbacksContext = createContext<{
handleSort?: (event: any) => void;
handleToggleItem?: (id: Identifier, event: any) => void;
isRowExpandable?: (record: any) => boolean;
isRowSelectable?: (record: any) => boolean;
onSelect?: ((ids: Identifier[]) => void) | undefined;
rowClick?: string | RowClickFunctionBase | false;
}>({});
export const useDataTableCallbacksContext = () =>
useContext(DataTableCallbacksContext);