|
|
@@ -11,7 +11,7 @@ import { TablePagination, Typography } from '@mui/material'; |
|
|
|
|
|
|
|
export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
hideFooterSelectedRowCount, rowModesModel, editMode, |
|
|
|
pageSizeOptions, filterItems, customPageSize, doLoad, ...props }) { |
|
|
|
pageSizeOptions, filterItems, customPageSize, doLoad, onGridReady, ...props }) { |
|
|
|
const intl = useIntl(); |
|
|
|
const [_rows, set_rows] = useState([]); |
|
|
|
const [_doLoad, set_doLoad] = useState({}); |
|
|
@@ -20,6 +20,7 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
const [_editMode, set_editMode] = useState("row"); |
|
|
|
const [_pageSizeOptions, set_pageSizeOptions] = useState([10]); |
|
|
|
const [_filterItems, set_filterItems] = useState([]); |
|
|
|
const [loading, setLoading] = useState(false); |
|
|
|
|
|
|
|
const [page, setPage] = useState(0); |
|
|
|
const [pageSize, setPageSize] = useState(10); |
|
|
@@ -52,8 +53,15 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
useEffect(() => { |
|
|
|
setPage(0); |
|
|
|
set_doLoad(doLoad); |
|
|
|
setLoading(true) |
|
|
|
}, [doLoad]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
setPage(0); |
|
|
|
set_doLoad(doLoad); |
|
|
|
setLoading(true) |
|
|
|
}, [onGridReady]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
getDataList(); |
|
|
|
}, [_doLoad, page]); |
|
|
@@ -127,6 +135,11 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, |
|
|
|
if (_doLoad.callback != null) { |
|
|
|
_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} |
|
|
|
filterModel={{ items: _filterItems }} |
|
|
|
sx={_sx} |
|
|
|
loading={loading} |
|
|
|
components={{ |
|
|
|
noRowsOverlay: CustomNoRowsOverlay, |
|
|
|
Pagination: () => ( |
|
|
|