Compare commits

..

5 Commits

Author SHA1 Message Date
AllenFang
7d7688582b Publish
- react-bootstrap-table2-filter@0.3.1
2018-07-30 23:27:23 +08:00
Allen
e26065b116 Merge pull request #440 from react-bootstrap-table/develop
20180730 release
2018-07-30 23:16:26 +08:00
Benny Johnson
6522f6d964 Commented out a check which caused the date filter to not update the (#425)
table when the date or date comparator were cleared

Modified applyFilter in date.js so that it doesn't try to parse an
Invalid Date. It was parsing an empty string, which caused it to pass
through an invalid date to onFilter, and this wasn't being checked for
properly by the onFilter function. It now checks for the empty string
and passes in null, which is what the onFilter function was actually
checking for
2018-07-25 11:20:35 +08:00
Allen
ecaf439e66 Merge pull request #420 from nthgol/patch-1
import numberFilter in numberFilter example
2018-07-19 10:15:57 +08:00
Nathan
90d03676ad import numberFilter in numberFilter example 2018-07-16 18:06:51 -04:00
3 changed files with 11 additions and 7 deletions

View File

@@ -131,7 +131,7 @@ const columns = [..., {
Numner filter is same as other filter, you can custom the number filter via `numberFilter` factory function:
```js
import filterFactory, { selectFilter, Comparator } from 'react-bootstrap-table2-filter';
import filterFactory, { selectFilter, Comparator, numberFilter } from 'react-bootstrap-table2-filter';
// omit...
const numberFilter = numberFilter({
@@ -240,4 +240,4 @@ Following properties is valid in `FILTER_TYPES`:
* TEXT
* SELECT
* NUMBER
* DATE
* DATE

View File

@@ -1,6 +1,6 @@
{
"name": "react-bootstrap-table2-filter",
"version": "0.3.0",
"version": "0.3.1",
"description": "it's a column filter addon for react-bootstrap-table2",
"main": "./lib/index.js",
"repository": {

View File

@@ -93,12 +93,16 @@ class DateFilter extends Component {
}
applyFilter(value, comparator) {
if (!comparator || !value) {
return;
}
// if (!comparator || !value) {
// return;
// }
const { column, onFilter, delay } = this.props;
const execute = () => {
const date = typeof value !== 'object' ? new Date(value) : value;
// Incoming value should always be a string, and the defaultDate
// above is implemented as an empty string, so we can just check for that.
// instead of parsing an invalid Date. The filter function will interpret
// null as an empty date field
const date = value === '' ? null : new Date(value);
onFilter(column, FILTER_TYPE.DATE)({ date, comparator });
};
if (delay) {