@azrico/reactgrid 1.3.20 → 1.3.22
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.
|
@@ -291,23 +291,25 @@ function DataGridSearchWrapper(props) {
|
|
|
291
291
|
const visibleColumns = props.gridRef.current.visibleColumns;
|
|
292
292
|
const columns_to_search = (0, _object.array_intersection)(props.advancedFilterFields || [], visibleColumns.map(r => r.id));
|
|
293
293
|
const lowerSearchText = currentSearch.current.toLowerCase().trim();
|
|
294
|
+
console.log('cols:', columns_to_search);
|
|
295
|
+
console.log('currentDS.current:', currentDS.current);
|
|
296
|
+
console.log('s:', lowerSearchText);
|
|
294
297
|
if (!lowerSearchText) newData = currentDS.current;else newData = currentDS.current.filter(p => {
|
|
295
298
|
for (let index = 0; index < columns_to_search.length; index++) {
|
|
296
299
|
const col = columns_to_search[index];
|
|
297
|
-
const v = (p[col] + '').toLowerCase(); //
|
|
300
|
+
const v = (p[col] + '').toLowerCase(); //value of column
|
|
298
301
|
if (v && v.indexOf(lowerSearchText) == -1) return false;
|
|
299
302
|
}
|
|
300
303
|
return true;
|
|
301
304
|
});
|
|
302
305
|
} else newData = currentDS.current;
|
|
306
|
+
console.log('newData:', newData.length);
|
|
303
307
|
set_filteredData(newData);
|
|
304
308
|
}, 1000), []);
|
|
305
309
|
_react.default.useEffect(() => {
|
|
306
310
|
set_search('');
|
|
307
|
-
(0, _object.fn_eval)(props.dataSource).then(
|
|
308
|
-
data
|
|
309
|
-
}) => {
|
|
310
|
-
currentDS.current = data;
|
|
311
|
+
(0, _object.fn_eval)(props.dataSource).then(r => {
|
|
312
|
+
currentDS.current = typeof r === 'object' ? r.data || r : r;
|
|
311
313
|
searchIfNeeded();
|
|
312
314
|
});
|
|
313
315
|
}, [props.dataSource]);
|
package/package.json
CHANGED
package/src/views/DataGrid.tsx
CHANGED
|
@@ -455,18 +455,22 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
|
|
|
455
455
|
visibleColumns.map((r) => r.id)
|
|
456
456
|
);
|
|
457
457
|
const lowerSearchText = currentSearch.current.toLowerCase().trim();
|
|
458
|
+
console.log('cols:', columns_to_search);
|
|
459
|
+
console.log('currentDS.current:', currentDS.current);
|
|
460
|
+
console.log('s:', lowerSearchText);
|
|
458
461
|
if (!lowerSearchText) newData = currentDS.current;
|
|
459
462
|
else
|
|
460
463
|
newData = currentDS.current.filter((p) => {
|
|
461
464
|
for (let index = 0; index < columns_to_search.length; index++) {
|
|
462
465
|
const col = columns_to_search[index];
|
|
463
|
-
const v = (p[col] + '').toLowerCase(); //
|
|
466
|
+
const v = (p[col] + '').toLowerCase(); //value of column
|
|
464
467
|
|
|
465
468
|
if (v && v.indexOf(lowerSearchText) == -1) return false;
|
|
466
469
|
}
|
|
467
470
|
return true;
|
|
468
471
|
});
|
|
469
472
|
} else newData = currentDS.current;
|
|
473
|
+
console.log('newData:', newData.length);
|
|
470
474
|
|
|
471
475
|
set_filteredData(newData);
|
|
472
476
|
}, 1000),
|
|
@@ -474,8 +478,8 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
|
|
|
474
478
|
);
|
|
475
479
|
React.useEffect(() => {
|
|
476
480
|
set_search('');
|
|
477
|
-
fn_eval(props.dataSource).then((
|
|
478
|
-
currentDS.current = data;
|
|
481
|
+
fn_eval(props.dataSource).then((r) => {
|
|
482
|
+
currentDS.current = typeof r === 'object' ? r.data || r : r;
|
|
479
483
|
searchIfNeeded();
|
|
480
484
|
});
|
|
481
485
|
}, [props.dataSource]);
|