@@ -38,7 +38,7 @@ import { IgcTrialWatermark } from 'igniteui-trial-watermark';
3838import { Subject , pipe , fromEvent , animationFrameScheduler , merge } from 'rxjs' ;
3939import { takeUntil , first , filter , throttleTime , map , shareReplay , takeWhile } from 'rxjs/operators' ;
4040import { cloneArray , mergeObjects , compareMaps , resolveNestedPath , isObject , PlatformUtil } from '../core/utils' ;
41- import { GridColumnDataType } from '../data-operations/data-util' ;
41+ import { DataUtil , GridColumnDataType } from '../data-operations/data-util' ;
4242import { FilteringLogic } from '../data-operations/filtering-expression.interface' ;
4343import { IGroupByRecord } from '../data-operations/groupby-record.interface' ;
4444import { IForOfDataChangeEventArgs , IgxGridForOfDirective } from '../directives/for-of/for_of.directive' ;
@@ -3911,10 +3911,12 @@ export abstract class IgxGridBaseDirective implements GridType,
39113911
39123912 this . activeNodeChange . pipe ( filter ( ( ) => ! this . _init ) , destructor ) . subscribe ( ( ) => {
39133913 this . _activeRowIndexes = null ;
3914+ this . refreshSearch ( ) ;
39143915 } ) ;
39153916
39163917 this . selectionService . selectedRangeChange . pipe ( filter ( ( ) => ! this . _init ) , destructor ) . subscribe ( ( ) => {
39173918 this . _activeRowIndexes = null ;
3919+ this . refreshSearch ( ) ;
39183920 } ) ;
39193921 }
39203922
@@ -7977,25 +7979,29 @@ export abstract class IgxGridBaseDirective implements GridType,
79777979 const caseSensitive = this . _lastSearchInfo . caseSensitive ;
79787980 const exactMatch = this . _lastSearchInfo . exactMatch ;
79797981 const searchText = caseSensitive ? this . _lastSearchInfo . searchText : this . _lastSearchInfo . searchText . toLowerCase ( ) ;
7980- const data = this . filteredSortedData ;
7982+ let data = this . filteredSortedData ;
7983+ if ( this . hasCellsToMerge ) {
7984+ data = DataUtil . merge ( cloneArray ( this . filteredSortedData ) , this . columnsToMerge , this . mergeStrategy , this . activeRowIndexes , this ) ;
7985+ }
79817986 const columnItems = this . visibleColumns . filter ( ( c ) => ! c . columnGroup ) . sort ( ( c1 , c2 ) => c1 . visibleIndex - c2 . visibleIndex ) ;
79827987 const columnsPathParts = columnItems . map ( col => columnFieldPath ( col . field ) ) ;
79837988
79847989 data . forEach ( ( dataRow , rowIndex ) => {
7990+ const currentRowData = this . isRecordMerged ( dataRow ) ? dataRow . recordRef : dataRow ;
79857991 columnItems . forEach ( ( c , cid ) => {
79867992 const pipeArgs = this . getColumnByName ( c . field ) . pipeArgs ;
7987- const value = c . formatter ? c . formatter ( resolveNestedPath ( dataRow , columnsPathParts [ cid ] ) , dataRow ) :
7988- c . dataType === 'number' ? formatNumber ( resolveNestedPath ( dataRow , columnsPathParts [ cid ] ) as number , this . locale , pipeArgs . digitsInfo ) :
7993+ const value = c . formatter ? c . formatter ( resolveNestedPath ( currentRowData , columnsPathParts [ cid ] ) , currentRowData ) :
7994+ c . dataType === 'number' ? formatNumber ( resolveNestedPath ( currentRowData , columnsPathParts [ cid ] ) as number , this . locale , pipeArgs . digitsInfo ) :
79897995 c . dataType === 'date'
7990- ? formatDate ( resolveNestedPath ( dataRow , columnsPathParts [ cid ] ) as string , pipeArgs . format , this . locale , pipeArgs . timezone )
7991- : resolveNestedPath ( dataRow , columnsPathParts [ cid ] ) ;
7996+ ? formatDate ( resolveNestedPath ( currentRowData , columnsPathParts [ cid ] ) as string , pipeArgs . format , this . locale , pipeArgs . timezone )
7997+ : resolveNestedPath ( currentRowData , columnsPathParts [ cid ] ) ;
79927998 if ( value !== undefined && value !== null && c . searchable ) {
79937999 let searchValue = caseSensitive ? String ( value ) : String ( value ) . toLowerCase ( ) ;
7994-
8000+ const isMergePlaceHolder = this . isRecordMerged ( dataRow ) ? ! ! dataRow ?. cellMergeMeta . get ( c . field ) ?. root : false ;
79958001 if ( exactMatch ) {
7996- if ( searchValue === searchText ) {
8002+ if ( searchValue === searchText && ! isMergePlaceHolder ) {
79978003 const mic : IMatchInfoCache = {
7998- row : dataRow ,
8004+ row : currentRowData ,
79998005 column : c . field ,
80008006 index : 0 ,
80018007 metadata : new Map < string , boolean > ( [ [ 'pinned' , this . isRecordPinnedByIndex ( rowIndex ) ] ] )
@@ -8007,9 +8013,9 @@ export abstract class IgxGridBaseDirective implements GridType,
80078013 let occurrenceIndex = 0 ;
80088014 let searchIndex = searchValue . indexOf ( searchText ) ;
80098015
8010- while ( searchIndex !== - 1 ) {
8016+ while ( searchIndex !== - 1 && ! isMergePlaceHolder ) {
80118017 const mic : IMatchInfoCache = {
8012- row : dataRow ,
8018+ row : currentRowData ,
80138019 column : c . field ,
80148020 index : occurrenceIndex ++ ,
80158021 metadata : new Map < string , boolean > ( [ [ 'pinned' , this . isRecordPinnedByIndex ( rowIndex ) ] ] )
0 commit comments