@@ -11,7 +11,7 @@ import { TablePagination, Typography } from '@mui/material'; | |||||
export function FiDataGrid({ rows, columns, sx, autoHeight, | export function FiDataGrid({ rows, columns, sx, autoHeight, | ||||
hideFooterSelectedRowCount, rowModesModel, editMode, | hideFooterSelectedRowCount, rowModesModel, editMode, | ||||
pageSizeOptions, filterItems, customPageSize, doLoad, ...props }) { | |||||
pageSizeOptions, filterItems, customPageSize, doLoad, onGridReady, ...props }) { | |||||
const intl = useIntl(); | const intl = useIntl(); | ||||
const [_rows, set_rows] = useState([]); | const [_rows, set_rows] = useState([]); | ||||
const [_doLoad, set_doLoad] = useState({}); | const [_doLoad, set_doLoad] = useState({}); | ||||
@@ -20,6 +20,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
const [_editMode, set_editMode] = useState("row"); | const [_editMode, set_editMode] = useState("row"); | ||||
const [_pageSizeOptions, set_pageSizeOptions] = useState([10]); | const [_pageSizeOptions, set_pageSizeOptions] = useState([10]); | ||||
const [_filterItems, set_filterItems] = useState([]); | const [_filterItems, set_filterItems] = useState([]); | ||||
const [loading, setLoading] = useState(false); | |||||
const [page, setPage] = useState(0); | const [page, setPage] = useState(0); | ||||
const [pageSize, setPageSize] = useState(10); | const [pageSize, setPageSize] = useState(10); | ||||
@@ -52,8 +53,15 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
useEffect(() => { | useEffect(() => { | ||||
setPage(0); | setPage(0); | ||||
set_doLoad(doLoad); | set_doLoad(doLoad); | ||||
setLoading(true) | |||||
}, [doLoad]); | }, [doLoad]); | ||||
useEffect(() => { | |||||
setPage(0); | |||||
set_doLoad(doLoad); | |||||
setLoading(true) | |||||
}, [onGridReady]); | |||||
useEffect(() => { | useEffect(() => { | ||||
getDataList(); | getDataList(); | ||||
}, [_doLoad, page]); | }, [_doLoad, page]); | ||||
@@ -127,6 +135,11 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
if (_doLoad.callback != null) { | if (_doLoad.callback != null) { | ||||
_doLoad.callback(responseData); | _doLoad.callback(responseData); | ||||
} | } | ||||
setLoading(false) | |||||
}, | |||||
onError: function (error){ | |||||
console.log(error) | |||||
setLoading(false) | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -148,6 +161,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, | |||||
hideFooterSelectedRowCount={myHideFooterSelectedRowCount} | hideFooterSelectedRowCount={myHideFooterSelectedRowCount} | ||||
filterModel={{ items: _filterItems }} | filterModel={{ items: _filterItems }} | ||||
sx={_sx} | sx={_sx} | ||||
loading={loading} | |||||
components={{ | components={{ | ||||
noRowsOverlay: CustomNoRowsOverlay, | noRowsOverlay: CustomNoRowsOverlay, | ||||
Pagination: () => ( | Pagination: () => ( | ||||
@@ -20,7 +20,7 @@ import { FormattedMessage, useIntl } from "react-intl"; | |||||
import * as utils from "auth/utils" | import * as utils from "auth/utils" | ||||
// ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
export default function SearchPublicNoticeTable({ searchCriteria }) { | |||||
export default function SearchPublicNoticeTable({ searchCriteria, onGridReady }) { | |||||
const [rows, setRows] = React.useState([]); | const [rows, setRows] = React.useState([]); | ||||
const navigate = useNavigate() | const navigate = useNavigate() | ||||
@@ -184,6 +184,7 @@ export default function SearchPublicNoticeTable({ searchCriteria }) { | |||||
customPageSize={10} | customPageSize={10} | ||||
getRowHeight={() => 'auto'} | getRowHeight={() => 'auto'} | ||||
onRowDoubleClick={handleRowDoubleClick} | onRowDoubleClick={handleRowDoubleClick} | ||||
onGridReady={onGridReady} | |||||
doLoad={React.useMemo(() => ({ | doLoad={React.useMemo(() => ({ | ||||
url: GET_PUBLIC_NOTICE_LIST, | url: GET_PUBLIC_NOTICE_LIST, | ||||
params: _searchCriteria, | params: _searchCriteria, | ||||
@@ -21,7 +21,7 @@ import {DemoItem} from "@mui/x-date-pickers/internals/demo"; | |||||
import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider"; | import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider"; | ||||
import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs"; | import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs"; | ||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, issueComboData | |||||
const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, issueComboData, setSearchReady | |||||
}) => { | }) => { | ||||
const [type, setType] = React.useState([]); | const [type, setType] = React.useState([]); | ||||
@@ -76,6 +76,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss | |||||
groupNo: data.groupNo, | groupNo: data.groupNo, | ||||
}; | }; | ||||
applySearch(temp); | applySearch(temp); | ||||
setSearchReady(true) | |||||
}; | }; | ||||
React.useEffect(() => { | React.useEffect(() => { | ||||
@@ -36,6 +36,7 @@ const UserSearchPage_Individual = () => { | |||||
dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)) | dateFrom: DateUtils.dateValue(new Date().setDate(new Date().getDate() - 14)) | ||||
}); | }); | ||||
const [onReady, setOnReady] = React.useState(false); | const [onReady, setOnReady] = React.useState(false); | ||||
const [onGridReady, setGridOnReady] = React.useState(false); | |||||
React.useEffect(() => { | React.useEffect(() => { | ||||
getOrgCombo(); | getOrgCombo(); | ||||
@@ -67,9 +68,15 @@ const UserSearchPage_Individual = () => { | |||||
} | } | ||||
function applySearch(input) { | function applySearch(input) { | ||||
setGridOnReady(false); | |||||
setSearchCriteria(input); | setSearchCriteria(input); | ||||
} | } | ||||
function setSearchReady(input) { | |||||
setGridOnReady(input); | |||||
} | |||||
return ( | return ( | ||||
!onReady ? | !onReady ? | ||||
<Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | <Grid container sx={{ minHeight: '87vh', mb: 3 }} direction="column" justifyContent="center" alignItems="center"> | ||||
@@ -93,6 +100,7 @@ const UserSearchPage_Individual = () => { | |||||
orgComboData={orgCombo} | orgComboData={orgCombo} | ||||
issueComboData={issueCombo} | issueComboData={issueCombo} | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
setSearchReady={setSearchReady} | |||||
/> | /> | ||||
</Grid> | </Grid> | ||||
{/*row 2*/} | {/*row 2*/} | ||||
@@ -104,7 +112,8 @@ const UserSearchPage_Individual = () => { | |||||
> | > | ||||
<EventTable | <EventTable | ||||
searchCriteria={searchCriteria} | searchCriteria={searchCriteria} | ||||
/> | |||||
onGridReady={onGridReady} | |||||
/> | |||||
</MainCard> | </MainCard> | ||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -155,7 +155,7 @@ const handleError = (error, onError) => { | |||||
if (onError) { | if (onError) { | ||||
return onError(error); | return onError(error); | ||||
} else { | } else { | ||||
console.log(error); | |||||
// console.log(error); | |||||
return false; | return false; | ||||
} | } | ||||
} | } |