Merge remote-tracking branch 'origin/feature/sein' into iipbs/st/dev
This commit is contained in:
@@ -720,6 +720,7 @@ const DataGrid = ({
|
||||
onCellEdited,
|
||||
onRowClick,
|
||||
onDataCellClick,
|
||||
onCellDblClick,
|
||||
onItemChecked,
|
||||
onItemAllChecked,
|
||||
onScrollToBottom,
|
||||
@@ -728,6 +729,7 @@ const DataGrid = ({
|
||||
idFieldName = "id",
|
||||
enableSort = false,
|
||||
gridHeight = 55, // vh 단위
|
||||
onRowDblClick,
|
||||
headerHeight = 60,
|
||||
fitStyle = GridFitStyle.EVEN,
|
||||
}: DataGridProps) => {
|
||||
@@ -766,6 +768,7 @@ const DataGrid = ({
|
||||
onCellEditedRef.current = onCellEdited;
|
||||
onDataCellClickRef.current = onDataCellClick;
|
||||
|
||||
|
||||
// highlightedRowId가 변경될 때 해당 행으로 스크롤 및 선택
|
||||
useEffect(() => {
|
||||
if (!gridRef.current?.gridView || highlightedRowId == null) return;
|
||||
@@ -781,7 +784,27 @@ const DataGrid = ({
|
||||
gridView.setFocus();
|
||||
}
|
||||
}, [highlightedRowId, rowData, idFieldName]);
|
||||
// 행 더블클릭 이벤트
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
if (!gridView || !onCellDblClick) return;
|
||||
|
||||
(gridView as any).onCellDblClicked = (_grid: unknown, clickData: { cellType?: string; itemIndex?: number }) => {
|
||||
if (clickData.cellType !== "data" || clickData.itemIndex === undefined) return;
|
||||
const row = rowDataRef.current[clickData.itemIndex];
|
||||
const cellIndex = (gridView as any).getCurrent?.();
|
||||
const fieldName = cellIndex?.fieldName ?? cellIndex?.column ?? "";
|
||||
if (row) onCellDblClick({ // ← 여기는 Props 콜백 호출이라 그대로
|
||||
row: row as Record<string, string | number>,
|
||||
fieldName,
|
||||
itemIndex: clickData.itemIndex
|
||||
});
|
||||
};
|
||||
|
||||
return () => {
|
||||
(gridView as any).onCellDblClicked = undefined;
|
||||
};
|
||||
}, [onCellDblClick]);
|
||||
useLayoutEffect(() => {
|
||||
const gv = gridRef.current?.gridView;
|
||||
if (!gv || !cellStyleCallback) return;
|
||||
|
||||
Reference in New Issue
Block a user