@azrico/reactgrid 1.3.24 → 1.3.26
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,20 +291,20 @@ 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
|
-
|
|
295
|
-
if (!lowerSearchText) newData = currentDS.current;else {
|
|
294
|
+
if (!lowerSearchText || columns_to_search.length === 0) newData = currentDS.current;else {
|
|
296
295
|
newData = currentDS.current.filter(p => {
|
|
297
296
|
for (let index = 0; index < columns_to_search.length; index++) {
|
|
298
297
|
const col = columns_to_search[index];
|
|
299
298
|
const v = (p[col] + '').toLowerCase(); //value of column
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
if (v && v.indexOf(lowerSearchText) != -1) {
|
|
300
|
+
//if one column is matching then the row is a match
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
302
303
|
}
|
|
303
|
-
return
|
|
304
|
+
return false;
|
|
304
305
|
});
|
|
305
306
|
}
|
|
306
307
|
} else newData = currentDS.current;
|
|
307
|
-
console.log('newData:', newData.length);
|
|
308
308
|
set_filteredData(newData);
|
|
309
309
|
}, 1000), []);
|
|
310
310
|
_react.default.useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azrico/reactgrid",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"description": "React Datagrid",
|
|
6
6
|
"author": "Azrideus <MehrdadTavangar@gmail.com>",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typescript": "^4.8.4"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@azrico/controls": "^1.5.
|
|
32
|
+
"@azrico/controls": "^1.5.62",
|
|
33
33
|
"@azrico/object": "^1.4.67",
|
|
34
34
|
"@emotion/react": "^11.9.3",
|
|
35
35
|
"@emotion/styled": "^11.9.3",
|
package/src/views/DataGrid.tsx
CHANGED
|
@@ -455,22 +455,22 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
|
|
|
455
455
|
visibleColumns.map((r) => r.id)
|
|
456
456
|
);
|
|
457
457
|
const lowerSearchText = currentSearch.current.toLowerCase().trim();
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
if (!lowerSearchText || columns_to_search.length === 0)
|
|
459
|
+
newData = currentDS.current;
|
|
460
460
|
else {
|
|
461
461
|
newData = currentDS.current.filter((p) => {
|
|
462
462
|
for (let index = 0; index < columns_to_search.length; index++) {
|
|
463
463
|
const col = columns_to_search[index];
|
|
464
464
|
const v = (p[col] + '').toLowerCase(); //value of column
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
if (v && v.indexOf(lowerSearchText) != -1) {
|
|
466
|
+
//if one column is matching then the row is a match
|
|
467
|
+
return true;
|
|
468
|
+
}
|
|
467
469
|
}
|
|
468
|
-
return
|
|
470
|
+
return false;
|
|
469
471
|
});
|
|
470
472
|
}
|
|
471
473
|
} else newData = currentDS.current;
|
|
472
|
-
console.log('newData:', newData.length);
|
|
473
|
-
|
|
474
474
|
set_filteredData(newData);
|
|
475
475
|
}, 1000),
|
|
476
476
|
[]
|