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]);