From 12a19d049618ccfe5751fc390f986fb8b052347e 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: Tue, 4 Oct 2022 11:01:12 +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=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/aprv/FlightPlanAprvGrid.js | 20 +------ src/components/crud/grid/GridDatatable.js | 56 ++++++++++--------- .../crud/grid/selectableRowsComponent.js | 16 +++--- .../flight/aprv/FlightPlanAprvContainer.js | 44 +++++++-------- 4 files changed, 62 insertions(+), 74 deletions(-) diff --git a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js index f182f94..c0582d2 100644 --- a/src/components/basis/flight/aprv/FlightPlanAprvGrid.js +++ b/src/components/basis/flight/aprv/FlightPlanAprvGrid.js @@ -11,8 +11,6 @@ const FlightPlanAprvGrid = ({ handleClickAprv, joinList, selectGroup, - selPlanSnoList, - setSelPlanSnoList, handleChangeCheckbox }) => { const [aprvAuth, setAprvAuth] = useState(''); @@ -49,24 +47,13 @@ const FlightPlanAprvGrid = ({ { id: 'planSno', name: '번호', - cell: (row, i) => ( - <> - handleChangeCheckbox(e, row)} - /> -
{i + 1}
- - ) + cell: (row, i) =>
{i + 1}
}, { id: 'fltPurpose', name: '비행목적', minWidth: '150px', - cell: row =>
{row.fltPurpose}
+ cell: (row, i) =>
{row.fltPurpose}
}, { id: 'fltMethod', @@ -142,10 +129,9 @@ 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 b1af304..e3e364a 100644 --- a/src/components/crud/grid/GridDatatable.js +++ b/src/components/crud/grid/GridDatatable.js @@ -14,33 +14,35 @@ export const GridDatabase = props => {
표시할 데이터가 없습니다.
) : ( <> - } - className='react-dataTable pal-dateTable' - // defaultSortField='invoiceId' - // paginationDefaultPage={currentPage} - // paginationComponent={CustomPagination} - data={props.data} - paginationServer={ - props.pagination && props.handlerPageChange ? true : false - } - onChangePage={props.pagination ? props.handlerPageChange : null} - paginationComponentOptions={{ - noRowsPerPage: props.handlerPageChange ? true : false - }} - selectableRows={props.selectableRows} - selectableRowsComponent={props.selectableRowsComponent} - onSelectedRowsChange={ - props.onSelectedRowsChange ? props.onSelectedRowsChange : null - } - /> +
+ } + className='react-dataTable pal-dateTable' + // defaultSortField='invoiceId' + // paginationDefaultPage={currentPage} + // paginationComponent={CustomPagination} + data={props.data} + paginationServer={ + props.pagination && props.handlerPageChange ? true : false + } + 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 index 3d0ba94..8a761b9 100644 --- a/src/components/crud/grid/selectableRowsComponent.js +++ b/src/components/crud/grid/selectableRowsComponent.js @@ -3,15 +3,15 @@ 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 e9febcb..56f285d 100644 --- a/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js +++ b/src/containers/basis/flight/aprv/FlightPlanAprvContainer.js @@ -174,29 +174,29 @@ const FlightPlanAprvContainer = () => { }; const handleChangeSelected = ({ selectedRows }) => { console.log(selectedRows); - setSelPlanSnoList(selectedRows.map(item => item.planSno)); + setSelPlanSnoList(selectedRows?.map(item => item.planSno)); }; - const handleChangeCheckbox = (e, row) => { - const { checked } = e.target; + // const handleChangeCheckbox = (e, row) => { + // const { checked } = e.target; - const dupli = selPlanSnoList?.find(prev => { - if (prev.planSno === row.planSno) { - return true; - } - }); - if (checked) { - if (!dupli) { - setSelPlanSnoList([...selPlanSnoList, row.planSno]); - } - } else { - const list = selPlanSnoList.filter(prev => { - if (prev !== row.planSno) { - return prev; - } - }); - setSelPlanSnoList(list); - } - }; + // const dupli = selPlanSnoList?.find(prev => { + // if (prev.planSno === row.planSno) { + // return true; + // } + // }); + // if (checked) { + // if (!dupli) { + // setSelPlanSnoList([...selPlanSnoList, row.planSno]); + // } + // } else { + // const list = selPlanSnoList.filter(prev => { + // if (prev !== row.planSno) { + // return prev; + // } + // }); + // setSelPlanSnoList(list); + // } + // }; const handleClickAprv = type => e => { // notAprov, aprv @@ -266,7 +266,7 @@ const FlightPlanAprvContainer = () => { handleChangeSelected={handleChangeSelected} selPlanSnoList={selPlanSnoList} setSelPlanSnoList={setSelPlanSnoList} - handleChangeCheckbox={handleChangeCheckbox} + // handleChangeCheckbox={handleChangeCheckbox} /> ) : (