UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

32 lines (31 loc) 1.63 kB
import { AdaptableModuleBase } from './AdaptableModuleBase'; import * as ModuleConstants from '../Utilities/Constants/ModuleConstants'; import { QuickSearchStatusBarContent } from '../View/QuickSearch/QuickSearchStatusBarContent'; import { QUICK_SEARCH_SET_CELL_MATCHING_STYLE_DEFAULT, QuickSearchSetCellMatchingStyle, } from '../Redux/ActionsReducers/QuickSearchRedux'; export class QuickSearchModule extends AdaptableModuleBase { constructor(api) { super(ModuleConstants.QuickSearchModuleId, ModuleConstants.QuickSearchFriendlyName, 'search-table', 'QuickSearchPopup', 'Quickly highlight all cells in the grid that contain matching query text', api); } getViewProperties() { return { getStatusBarPanelProps() { return { content: QuickSearchStatusBarContent, }; }, }; } onAdaptableReady() { const { api } = this; const { internalApi, agGridApi } = api; const isServerSideRowModel = agGridApi.getGridOption('rowModelType') === 'serverSide'; if (isServerSideRowModel && internalApi.getAdaptableState().QuickSearch.CellMatchStyle === undefined) { // for server side row model, // let's setup some defaults if there are no styles set // as there are no defaults in the AG Grid find functionality (as it only works for non ssrm) // so we need to set the defaults here this.api.internalApi.dispatchReduxAction(QuickSearchSetCellMatchingStyle(QUICK_SEARCH_SET_CELL_MATCHING_STYLE_DEFAULT)); } } }