Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Added functionality for clearing filters applied on tables. #100

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/src/components/dbfragments/table/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useAppDispatch, useAppSelector } from '../../../redux/hooks'
import { deleteDBData, setQueryData, updateDBSingleData } from '../../../redux/dataModelSlice'
import { DBConnType } from '../../../data/defaults'
import TabContext from '../../layouts/tabcontext'
import { filter } from 'lodash'
Copy link
Owner

@paraswaykole paraswaykole Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this filter import by mistake?



type TablePropType = {
Expand Down Expand Up @@ -150,6 +151,11 @@ const Table = ({ queryData, dbConnection, mSchema, mName, isEditable, showHeader
}
onFilterChanged(filter)
}
const onFilterClear = () =>{
let filter: string[] | undefined = undefined
setFilterValue(['default', 'default', '']);
onFilterChanged(filter);
}

const changeSort = (newSortIdx: string) => {
if (!isEditable) {
Expand Down Expand Up @@ -216,6 +222,9 @@ const Table = ({ queryData, dbConnection, mSchema, mName, isEditable, showHeader
<p className="control">
<button className="button" onClick={onFilter}>Filter</button>
</p>
<p className="control">
<button className="button" onClick={onFilterClear} >Clear Filter</button>
</p>
</div>
</div>
{isEditable && <React.Fragment>
Expand Down