From e7271ce92733368e1f49dac5e1b816c6feb0e20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Fri, 30 Sep 2022 16:18:17 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B3=84=ED=9A=8D=EC=8A=B9?= =?UTF-8?q?=EC=9D=B8=20-=20=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20?= =?UTF-8?q?=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/aprv/FlightPlanAprvGrid.js | 9 ++++++--- src/components/crud/grid/GridDatatable.js | 10 ++++++---- .../crud/grid/selectableRowsComponent.js | 17 +++++++++++++++++ .../flight/aprv/FlightPlanAprvContainer.js | 1 + .../flight/plan/FlightPlanDetailContainer.js | 4 ++-- 5 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/components/crud/grid/selectableRowsComponent.js diff --git a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js index 4969fc5..f182f94 100644 --- a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js +++ b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js @@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'; import { Button, Card, Col, Row, CustomInput } from 'reactstrap'; import { GridDatabase } from '../../../crud/grid/GridDatatable'; import { Link } from 'react-router-dom'; +import { selectableRowsComponent } from '../../../crud/grid/selectableRowsComponent'; const FlightPlanAprvGrid = ({ data, @@ -50,13 +51,13 @@ const FlightPlanAprvGrid = ({ name: '번호', cell: (row, i) => ( <> - {/* handleChangeCheckbox(e, row)} - /> */} + />
{i + 1}
) @@ -141,8 +142,10 @@ const FlightPlanAprvGrid = ({ columns={columns} count={!!data ? data.length : 0} // pagination={props.pagination} - selectableRows + selectableRows //체크박스 할거다 + selectableRowsComponent={selectableRowsComponent} onSelectedRowsChange={handleChangeSelected} + // onSelectedRowsChange={handleChangeCheckbox} /> {/* 검색된 데이터가 없습니다. */} diff --git a/src/components/crud/grid/GridDatatable.js b/src/components/crud/grid/GridDatatable.js index 07aef16..b1af304 100644 --- a/src/components/crud/grid/GridDatatable.js +++ b/src/components/crud/grid/GridDatatable.js @@ -7,6 +7,7 @@ import { File, ChevronDown } from 'react-feather'; +import { selectableRowsComponent } from './selectableRowsComponent'; export const GridDatabase = props => { return props[`${props.handlerPageChange ? 'total' : 'count'}`] <= 0 ? ( @@ -30,14 +31,15 @@ export const GridDatabase = props => { paginationServer={ props.pagination && props.handlerPageChange ? true : false } - onSelectedRowsChange={ - props.onSelectedRowsChange ? props.onSelectedRowsChange : null - } - selectableRows={props.selectableRows} onChangePage={props.pagination ? props.handlerPageChange : null} paginationComponentOptions={{ noRowsPerPage: props.handlerPageChange ? true : false }} + selectableRows={props.selectableRows} + selectableRowsComponent={props.selectableRowsComponent} + onSelectedRowsChange={ + props.onSelectedRowsChange ? props.onSelectedRowsChange : null + } /> ); diff --git a/src/components/crud/grid/selectableRowsComponent.js b/src/components/crud/grid/selectableRowsComponent.js new file mode 100644 index 0000000..3d0ba94 --- /dev/null +++ b/src/components/crud/grid/selectableRowsComponent.js @@ -0,0 +1,17 @@ +import { CustomInput, Input } from 'reactstrap'; +import React from 'react'; + +export const selectableRowsComponent = React.forwardRef( + ({ onClick, ...rest }, ref) => { + console.log(rest); + return ( + + ); + } +); diff --git a/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js index 89203ef..e9febcb 100644 --- a/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js +++ b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js @@ -173,6 +173,7 @@ const FlightPlanAprvContainer = () => { })); }; const handleChangeSelected = ({ selectedRows }) => { + console.log(selectedRows); setSelPlanSnoList(selectedRows.map(item => item.planSno)); }; const handleChangeCheckbox = (e, row) => { diff --git a/src/containers/basis/flight/plan/FlightPlanDetailContainer.js b/src/containers/basis/flight/plan/FlightPlanDetailContainer.js index 9bbdb94..d079d03 100644 --- a/src/containers/basis/flight/plan/FlightPlanDetailContainer.js +++ b/src/containers/basis/flight/plan/FlightPlanDetailContainer.js @@ -45,9 +45,9 @@ const FlightPlanDetailContainer = () => { let cTime = new Date(); let pTime = new Date(date); if (cTime > pTime) { - setIsDone(true); + // setIsDone(true); } else { - setIsDone(false); + // setIsDone(false); } } }, [date]);