fix: update filter handling in data filtering logic
- Refactored the handling of "in" and "not_in" operators to ensure proper array handling and prevent errors when values are not provided. - Enhanced the InteractiveDataTable component to re-fetch data when filters are applied, improving user experience. - Updated DataFilterConfigPanel to correctly manage filter values based on selected operators. - Adjusted SplitPanelLayoutComponent to apply client-side data filtering based on defined conditions. These changes aim to improve the robustness and usability of the data filtering features across the application.
This commit is contained in:
@@ -605,6 +605,23 @@ export const InteractiveDataTable: React.FC<InteractiveDataTableProps> = ({
|
||||
}
|
||||
}, [relatedButtonFilter]);
|
||||
|
||||
// TableOptionsContext 필터 변경 시 데이터 재조회 (TableSearchWidget 연동)
|
||||
const filtersAppliedRef = useRef(false);
|
||||
useEffect(() => {
|
||||
// 초기 렌더 시 빈 배열은 무시 (불필요한 재조회 방지)
|
||||
if (!filtersAppliedRef.current && filters.length === 0) return;
|
||||
filtersAppliedRef.current = true;
|
||||
|
||||
const filterSearchParams: Record<string, any> = {};
|
||||
filters.forEach((f) => {
|
||||
if (f.value !== "" && f.value !== undefined && f.value !== null) {
|
||||
filterSearchParams[f.columnName] = f.value;
|
||||
}
|
||||
});
|
||||
loadData(1, { ...searchValues, ...filterSearchParams });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [filters]);
|
||||
|
||||
// 카테고리 타입 컬럼의 값 매핑 로드
|
||||
useEffect(() => {
|
||||
const loadCategoryMappings = async () => {
|
||||
|
||||
Reference in New Issue
Block a user