fix: 기존 필드의 자동 채우기 테이블 컬럼 초기 로드 추가

- 초기 렌더링 시 기존 필드들의 autoFillFromTable이 설정되어 있으면 컬럼 자동 로드
- useEffect로 localFields 초기화 시점에 모든 필드 순회하며 컬럼 로드
- 사용자가 저장된 설정을 열었을 때 즉시 컬럼 목록 표시

문제: 품목정보 테이블을 선택했지만 컬럼이 표시되지 않음
원인: 기존에 설정된 autoFillFromTable에 대한 컬럼이 초기 로드되지 않음
해결: 초기화 useEffect 추가로 기존 설정 복원
This commit is contained in:
kjs 2025-11-20 17:52:40 +09:00
parent 86eb9f0425
commit 6e5e3a04f3
1 changed files with 12 additions and 0 deletions

View File

@ -140,6 +140,18 @@ export const SelectedItemsDetailInputConfigPanel: React.FC<SelectedItemsDetailIn
loadColumns();
}, [config.targetTable]);
// 🆕 초기 렌더링 시 기존 필드들의 autoFillFromTable 컬럼 로드
useEffect(() => {
if (!localFields || localFields.length === 0) return;
localFields.forEach((field, index) => {
if (field.autoFillFromTable && !autoFillTableColumns[index]) {
console.log(`🔍 [초기화] 필드 ${index}의 기존 테이블 컬럼 로드:`, field.autoFillFromTable);
loadAutoFillTableColumns(field.autoFillFromTable, index);
}
});
}, []); // 초기 한 번만 실행
// 🆕 자동 채우기 테이블 선택 시 컬럼 로드
const loadAutoFillTableColumns = async (tableName: string, fieldIndex: number) => {
if (!tableName) {