@visns-studio/visns-components 3.8.13 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -158,13 +158,6 @@ const DataGrid = ({
|
|
|
158
158
|
const [gridColumns, setGridColumns] = useState([]);
|
|
159
159
|
const [limit, setLimit] = useState(ajaxSetting.take || 10);
|
|
160
160
|
const [search, setSearch] = useState('');
|
|
161
|
-
const sortInfo =
|
|
162
|
-
ajaxSetting.sortBy && ajaxSetting.sort
|
|
163
|
-
? {
|
|
164
|
-
name: ajaxSetting.sortBy,
|
|
165
|
-
dir: ajaxSetting.sort === 'asc' ? 1 : -1,
|
|
166
|
-
}
|
|
167
|
-
: null;
|
|
168
161
|
|
|
169
162
|
/** Table Functions */
|
|
170
163
|
const handleChangeSearch = (e) => {
|
|
@@ -51,7 +51,7 @@ import Form from './Form';
|
|
|
51
51
|
import _ from 'lodash';
|
|
52
52
|
|
|
53
53
|
const loadData = async (
|
|
54
|
-
{ skip, limit, sortInfo,
|
|
54
|
+
{ skip, limit, sortInfo, filterValue },
|
|
55
55
|
search,
|
|
56
56
|
ajaxSetting
|
|
57
57
|
) => {
|
|
@@ -157,11 +157,10 @@ const DataGrid = forwardRef(
|
|
|
157
157
|
useEffect(() => {
|
|
158
158
|
setFormData(form);
|
|
159
159
|
}, [form]);
|
|
160
|
-
|
|
161
160
|
/** Table States */
|
|
162
161
|
const [dataReload, setDataReload] = useState(0);
|
|
163
162
|
const [dSearch, setDSearch] = useState('');
|
|
164
|
-
const
|
|
163
|
+
const dataSource = useCallback(
|
|
165
164
|
(params) => {
|
|
166
165
|
const sqlResult = loadData(params, dSearch, ajaxSetting);
|
|
167
166
|
if (setFilterData && params.filterValue) {
|
|
@@ -549,13 +548,15 @@ const DataGrid = forwardRef(
|
|
|
549
548
|
};
|
|
550
549
|
|
|
551
550
|
const handleReload = () => {
|
|
552
|
-
const min = 0;
|
|
553
|
-
const max = 999999999;
|
|
554
|
-
const randomNumber = Math.floor(
|
|
555
|
-
|
|
556
|
-
);
|
|
551
|
+
// const min = 0;
|
|
552
|
+
// const max = 999999999;
|
|
553
|
+
// const randomNumber = Math.floor(
|
|
554
|
+
// Math.random() * (max - min + 1) + min
|
|
555
|
+
// );
|
|
556
|
+
|
|
557
|
+
// setDataReload(randomNumber);
|
|
557
558
|
|
|
558
|
-
|
|
559
|
+
gridRef.current.paginationProps.reload();
|
|
559
560
|
};
|
|
560
561
|
|
|
561
562
|
const handleSort = (value) => {
|
|
@@ -2488,7 +2489,7 @@ const DataGrid = forwardRef(
|
|
|
2488
2489
|
<ReactDataGrid
|
|
2489
2490
|
{...tableSetting}
|
|
2490
2491
|
columns={gridColumns}
|
|
2491
|
-
dataSource={
|
|
2492
|
+
dataSource={dataSource}
|
|
2492
2493
|
filterValue={filterValue}
|
|
2493
2494
|
limit={limit}
|
|
2494
2495
|
enableColumnAutosize={false}
|
|
@@ -2543,6 +2544,7 @@ const DataGrid = forwardRef(
|
|
|
2543
2544
|
fetchTable={handleReload}
|
|
2544
2545
|
formSettings={formData}
|
|
2545
2546
|
formType={formType}
|
|
2547
|
+
gridRef={gridRef}
|
|
2546
2548
|
mapbox={mapbox}
|
|
2547
2549
|
paramValue={paramValue}
|
|
2548
2550
|
style={style}
|
package/package.json
CHANGED