|
|
@@ -6,12 +6,13 @@ import { |
|
|
|
import * as HttpUtils from "utils/HttpUtils"; |
|
|
|
import { FormattedMessage, useIntl } from "react-intl"; |
|
|
|
import { TablePagination, Typography } from '@mui/material'; |
|
|
|
import { getSearchCriteria } from "auth/utils"; |
|
|
|
|
|
|
|
// ==============================|| EVENT TABLE ||============================== // |
|
|
|
|
|
|
|
export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
hideFooterSelectedRowCount, rowModesModel, editMode, |
|
|
|
pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, ...props }) { |
|
|
|
pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, applySearch, ...props }) { |
|
|
|
const intl = useIntl(); |
|
|
|
const [_rows, set_rows] = useState([]); |
|
|
|
const [_doLoad, set_doLoad] = useState({}); |
|
|
@@ -52,7 +53,16 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (doLoad !== undefined && Object.keys(doLoad).length>0 ){ |
|
|
|
setPage(0); |
|
|
|
if(applySearch!=undefined){ |
|
|
|
if (Object.keys(getSearchCriteria(window.location.pathname)).length>0){ |
|
|
|
const localStorageSearchCriteria = getSearchCriteria(window.location.pathname) |
|
|
|
if(localStorageSearchCriteria.start!=undefined){ |
|
|
|
setPage(localStorageSearchCriteria.start/pageSize); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
setPage(0); |
|
|
|
} |
|
|
|
set_doLoad(doLoad); |
|
|
|
setLoading(true) |
|
|
|
} |
|
|
@@ -137,6 +147,8 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
if (_doLoad.params == null) _doLoad.params = {}; |
|
|
|
_doLoad.params.start = page * pageSize; |
|
|
|
_doLoad.params.limit = pageSize; |
|
|
|
localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) |
|
|
|
|
|
|
|
HttpUtils.get({ |
|
|
|
url: _doLoad.url, |
|
|
|
params: _doLoad.params, |
|
|
|