Skip to content

Commit

Permalink
Events Table search filter persists when scrolling horizontally
Browse files Browse the repository at this point in the history
Signed-off-by: Ankush-Tyagi <ankush.tyagi@ericsson.com>
  • Loading branch information
hriday-panchasara authored and ankusht-work committed Jan 31, 2023
1 parent 8757351 commit 4d52749
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ describe('Table output component tests', () => {
columnApi={new ColumnApi()}
showParentFilter={mockShowParentFilter}
context={''}
filterModel= {new Map<string,string>()}
/>).toJSON();
expect(searchFilter).toMatchSnapshot();
});
Expand Down Expand Up @@ -175,6 +176,7 @@ describe('Table output component tests', () => {
columnApi={new ColumnApi()}
showParentFilter={mockShowParentFilter}
context={''}
filterModel={new Map<string,string>()}
/>);

const parentDiv = screen.getByTestId('search-filter-element-parent');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
rowSelection='multiple'
onModelUpdated={this.onModelUpdated}
onCellKeyDown={this.onKeyDown}
frameworkComponents={this.frameworkComponents}
components={this.frameworkComponents}
enableBrowserTooltips={true}
>
</AgGridReact>
Expand Down Expand Up @@ -428,7 +428,8 @@ export class TableOutputComponent extends AbstractOutputComponent<TableOutputPro
onFilterChange: this.searchEvents,
onclickNext: () => this.findMatchedEvent(Direction.NEXT),
onclickPrevious: () => this.findMatchedEvent(Direction.PREVIOUS),
colName: columnHeader.id.toString()
colName: columnHeader.id.toString(),
filterModel: this.filterModel
},
icons: {
filter: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type SearchFilterRendererProps = IFloatingFilterParams & {
onclickNext: () => void;
onclickPrevious: () => void;
colName: string;
filterModel: Map<string, string>;
};

interface SearchFilterRendererState {
Expand Down Expand Up @@ -79,7 +80,7 @@ export class SearchFilterRenderer extends React.Component<SearchFilterRendererPr
super(props);
this.state = {
hasHovered: false,
hasClicked: false
hasClicked: this.props.filterModel.has(this.props.colName)
};

this.debouncedChangeHandler = debounce((colName, inputVal) => {
Expand Down Expand Up @@ -111,10 +112,12 @@ export class SearchFilterRenderer extends React.Component<SearchFilterRendererPr
<div>
<input
data-testid="search-filter-element-input"
type="text" autoFocus={true}
type="text"
autoFocus={true}
onKeyDown={this.onKeyDownEvent}
onInput={this.onInputBoxChanged}
style={{ width: '50%', margin: '10px' }}
defaultValue={this.props.filterModel.get(this.props.colName) ?? ''}
/>
<FontAwesomeIcon className='hoverClass' icon={faTimes} style={{ marginTop: '20px' }} onClick={this.onCloseClickHandler} />
<FontAwesomeIcon className='hoverClass' icon={faAngleDown} style={{ marginLeft: '10px', marginTop: '20px' }} onClick={this.onDownClickHandler} />
Expand Down

0 comments on commit 4d52749

Please sign in to comment.