diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstAdd.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstAdd.tsx index 6f76667c8..df5aaca77 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstAdd.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstAdd.tsx @@ -7,7 +7,7 @@ import { formH1Class } from "@/components/lib/class/comClass"; import { safeDate } from "@/components/lib/func/commom"; import { DatePicker, FormField, FormUi, SelectBox } from "@common/business_components"; import { Button, Checkbox, Input } from "@common/components"; -import { useState } from "react"; +import { useRef, useState } from "react"; import { useFieldArray } from "react-hook-form"; export default function BdstAdd({ form, readonly }: { form: any; readonly?: boolean; }) { @@ -21,12 +21,21 @@ export default function BdstAdd({ form, readonly }: { form: any; readonly?: bool control: form?.control, // Provide a fallback to avoid errors }); + const bottomRef = useRef(null); + const plusHist = () => { append({ bdstChgNm: code.chBuCd[0]?.val, archChgPrmsnDt: new Date(), archChgArea: "", }); + + // 새 항목이 렌더링된 후 스크롤 이동 + setTimeout(() => { + if (bottomRef.current) { + bottomRef.current.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); + } + }, 100); }; const [selectedIds, setSelectedIds] = useState([]); @@ -142,7 +151,7 @@ export default function BdstAdd({ form, readonly }: { form: any; readonly?: bool ))} -
+
) } \ No newline at end of file