@@ -633,6 +633,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
633633 this . setFilterMap = this . setFilterMap . bind ( this ) ;
634634 this . handleFrozenColumnsChanged =
635635 this . handleFrozenColumnsChanged . bind ( this ) ;
636+ this . handleSetQuickFilters = this . handleSetQuickFilters . bind ( this ) ;
637+ this . handleSetAdvancedFilters = this . handleSetAdvancedFilters . bind ( this ) ;
638+ this . handleSetSorts = this . handleSetSorts . bind ( this ) ;
639+ this . handleSetReverse = this . handleSetReverse . bind ( this ) ;
640+ this . clearAllFilters = this . clearAllFilters . bind ( this ) ;
636641
637642 this . grid = null ;
638643 this . lastLoadedConfig = null ;
@@ -1138,7 +1143,15 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
11381143 isTableDownloading : boolean ,
11391144 tableDownloadStatus : string ,
11401145 tableDownloadProgress : number ,
1141- tableDownloadEstimatedTime : number | null
1146+ tableDownloadEstimatedTime : number | null ,
1147+ quickFilters : ReadonlyQuickFilterMap ,
1148+ advancedFilters : ReadonlyAdvancedFilterMap ,
1149+ searchFilter : DhType . FilterCondition | undefined ,
1150+ searchValue : string ,
1151+ selectedSearchColumns : readonly ColumnName [ ] ,
1152+ invertSearchColumns : boolean ,
1153+ sorts : readonly SortDescriptor [ ] ,
1154+ reverse : boolean
11421155 ) : GridStateSnapshot => ( {
11431156 model,
11441157 customColumns,
@@ -1158,6 +1171,14 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
11581171 tableDownloadStatus,
11591172 tableDownloadProgress,
11601173 tableDownloadEstimatedTime,
1174+ quickFilters,
1175+ advancedFilters,
1176+ searchFilter,
1177+ searchValue,
1178+ selectedSearchColumns,
1179+ invertSearchColumns,
1180+ sorts,
1181+ reverse,
11611182 } ) ,
11621183 { max : 1 }
11631184 ) ;
@@ -1219,6 +1240,28 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
12191240 case 'CANCEL_DOWNLOAD' :
12201241 this . handleCancelDownloadTable ( ) ;
12211242 break ;
1243+ case 'SET_QUICK_FILTERS' :
1244+ this . handleSetQuickFilters ( action . filters ) ;
1245+ break ;
1246+ case 'SET_ADVANCED_FILTERS' :
1247+ this . handleSetAdvancedFilters ( action . filters ) ;
1248+ break ;
1249+ case 'SET_SORTS' :
1250+ this . handleSetSorts ( action . sorts ) ;
1251+ break ;
1252+ case 'SET_REVERSE' :
1253+ this . handleSetReverse ( action . reverse ) ;
1254+ break ;
1255+ case 'CLEAR_ALL_FILTERS' :
1256+ this . clearAllFilters ( ) ;
1257+ break ;
1258+ case 'SET_CROSS_COLUMN_SEARCH' :
1259+ this . handleCrossColumnSearch (
1260+ action . searchValue ,
1261+ action . selectedSearchColumns ,
1262+ action . invertSearchColumns
1263+ ) ;
1264+ break ;
12221265 default :
12231266 log . warn (
12241267 `Unknown TableOptions action type: ${ ( action as GridAction ) . type } `
@@ -1870,6 +1913,42 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
18701913 } ) ;
18711914 }
18721915
1916+ /**
1917+ * Handler for setting quick filters from table options.
1918+ */
1919+ handleSetQuickFilters ( filters : ReadonlyQuickFilterMap ) : void {
1920+ log . debug ( 'Setting quick filters' , filters ) ;
1921+ this . startLoading ( 'Applying Filters...' ) ;
1922+ this . setState ( { quickFilters : filters } ) ;
1923+ }
1924+
1925+ /**
1926+ * Handler for setting advanced filters from table options.
1927+ */
1928+ handleSetAdvancedFilters ( filters : ReadonlyAdvancedFilterMap ) : void {
1929+ log . debug ( 'Setting advanced filters' , filters ) ;
1930+ this . startLoading ( 'Applying Filters...' ) ;
1931+ this . setState ( { advancedFilters : filters } ) ;
1932+ }
1933+
1934+ /**
1935+ * Handler for setting sorts from table options.
1936+ */
1937+ handleSetSorts ( newSorts : readonly SortDescriptor [ ] ) : void {
1938+ log . debug ( 'Setting sorts' , newSorts ) ;
1939+ this . startLoading ( 'Sorting...' ) ;
1940+ this . setState ( { sorts : newSorts } ) ;
1941+ }
1942+
1943+ /**
1944+ * Handler for setting reverse sort from table options.
1945+ */
1946+ handleSetReverse ( newReverse : boolean ) : void {
1947+ log . debug ( 'Setting reverse' , newReverse ) ;
1948+ this . startLoading ( 'Sorting...' ) ;
1949+ this . setState ( { reverse : newReverse } ) ;
1950+ }
1951+
18731952 clearAllAggregations ( ) : void {
18741953 log . debug ( 'Clearing all aggregations' ) ;
18751954
@@ -5216,6 +5295,14 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
52165295 isChartBuilderAvailable = {
52175296 onCreateChart !== undefined && model . isChartBuilderAvailable
52185297 }
5298+ quickFilters = { quickFilters }
5299+ advancedFilters = { advancedFilters }
5300+ searchFilter = { searchFilter }
5301+ searchValue = { searchValue }
5302+ selectedSearchColumns = { selectedSearchColumns }
5303+ invertSearchColumns = { invertSearchColumns }
5304+ sorts = { sorts }
5305+ reverse = { reverse }
52195306 onCreateChart = {
52205307 onCreateChart
52215308 ? settings => onCreateChart ( settings , model )
@@ -5224,6 +5311,12 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
52245311 onChartChange = { ( ) => {
52255312 // TODO: IDS-4242 Update Chart Preview
52265313 } }
5314+ onSetQuickFilters = { this . handleSetQuickFilters }
5315+ onSetAdvancedFilters = { this . handleSetAdvancedFilters }
5316+ onSetSorts = { this . handleSetSorts }
5317+ onSetReverse = { this . handleSetReverse }
5318+ onClearAllFilters = { this . clearAllFilters }
5319+ onSetCrossColumnSearch = { this . handleCrossColumnSearch }
52275320 onClose = { this . handleMenuClose }
52285321 />
52295322 </ div >
0 commit comments