mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
Merge branch 'jehartzog-fix-select-filter-typo' into develop
This commit is contained in:
commit
9e3ae385ce
@ -8,9 +8,9 @@ import { productsQualityGenerator } from 'utils/common';
|
||||
const products = productsQualityGenerator(6);
|
||||
|
||||
const selectOptions = [
|
||||
{ label: 0, value: 'good' },
|
||||
{ label: 1, value: 'Bad' },
|
||||
{ label: 2, value: 'unknown' }
|
||||
{ value: 0, label: 'good' },
|
||||
{ value: 1, label: 'Bad' },
|
||||
{ value: 2, label: 'unknown' }
|
||||
];
|
||||
|
||||
const columns = [{
|
||||
@ -22,7 +22,7 @@ const columns = [{
|
||||
}, {
|
||||
dataField: 'quality',
|
||||
text: 'Product Quailty',
|
||||
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
|
||||
formatter: cell => selectOptions.find(opt => opt.value === cell).label,
|
||||
filter: selectFilter({
|
||||
options: selectOptions
|
||||
})
|
||||
@ -33,9 +33,9 @@ import BootstrapTable from 'react-bootstrap-table-next';
|
||||
import filterFactory, { selectFilter } from 'react-bootstrap-table2-filter';
|
||||
|
||||
const selectOptions = [
|
||||
{ label: 0, value: 'good' },
|
||||
{ label: 1, value: 'Bad' },
|
||||
{ label: 2, value: 'unknown' }
|
||||
{ value: 0, label: 'good' },
|
||||
{ value: 1, label: 'Bad' },
|
||||
{ value: 2, label: 'unknown' }
|
||||
];
|
||||
|
||||
const columns = [{
|
||||
@ -47,7 +47,7 @@ const columns = [{
|
||||
}, {
|
||||
dataField: 'quality',
|
||||
text: 'Product Quailty',
|
||||
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
|
||||
formatter: cell => selectOptions.find(opt => opt.value === cell).label,
|
||||
filter: selectFilter({
|
||||
options: selectOptions
|
||||
})
|
||||
|
||||
@ -119,15 +119,15 @@ const qualityFilter = selectFilter({
|
||||
|
||||
```js
|
||||
const selectOptions = [
|
||||
{ label: 0, value: 'good' },
|
||||
{ label: 1, value: 'Bad' },
|
||||
{ label: 2, value: 'unknown' }
|
||||
{ value: 0, label: 'good' },
|
||||
{ value: 1, label: 'Bad' },
|
||||
{ value: 2, label: 'unknown' }
|
||||
];
|
||||
const columns = [
|
||||
..., {
|
||||
dataField: 'quality',
|
||||
text: 'Product Quailty',
|
||||
formatter: cell => selectOptions.find(opt => opt.label === cell).value,
|
||||
formatter: cell => selectOptions.find(opt => opt.value === cell).label,
|
||||
filter: selectFilter({
|
||||
options: selectOptions
|
||||
})
|
||||
|
||||
@ -9,7 +9,10 @@ import { FILTER_TYPE } from '../const';
|
||||
function optionsEquals(currOpts, prevOpts) {
|
||||
if (Array.isArray(currOpts)) {
|
||||
for (let i = 0; i < currOpts.length; i += 1) {
|
||||
if (currOpts[i].label !== prevOpts[i].label) {
|
||||
if (
|
||||
currOpts[i].value !== prevOpts[i].value ||
|
||||
currOpts[i].label !== prevOpts[i].label
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -86,7 +89,7 @@ class SelectFilter extends Component {
|
||||
}
|
||||
if (Array.isArray(options)) {
|
||||
options.forEach(({ value, label }) =>
|
||||
optionTags.push(<option key={ label } value={ label }>{ value }</option>));
|
||||
optionTags.push(<option key={ value } value={ value }>{ label }</option>));
|
||||
} else {
|
||||
Object.keys(options).forEach(key =>
|
||||
optionTags.push(<option key={ key } value={ key }>{ options[key] }</option>)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user