fix: remove optional chaining, change TS version

This commit is contained in:
Wlad Meixner
2020-04-04 22:44:27 +02:00
parent 8250920265
commit 36bc283d2f
2 changed files with 5 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
// Project: https://github.com/react-bootstrap-table/react-bootstrap-table2#readme
// Definitions by: Wlad Meixner <https://github.com/gosticks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.7
// TypeScript Version: 3.0
// documentation taken from https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/table-props.html

View File

@@ -211,7 +211,10 @@ const selectColumns = [
{
dataField: 'quality',
text: 'Product Quailty',
formatter: (cell: number) => selectOptionsList.find(val => val.value === cell)?.value ?? '',
formatter: (cell: number) => {
const found = selectOptionsList.find(val => val.value === cell);
return found ? found.value : '';
},
filter: selectFilter({
options: selectOptionsList,
className: 'test-classname',
@@ -226,24 +229,6 @@ const selectColumns = [
onFilter: filterValue => {},
}),
},
{
dataField: 'quality',
text: 'Product Quailty',
formatter: (cell: number) => selectOptionsList.find(val => val.value === cell)?.value ?? '',
filter: selectFilter({
options: selectOptionsCreator,
className: 'test-classname',
withoutEmptyOption: true,
defaultValue: 2,
comparator: Comparator.LIKE, // default is Comparator.EQ
style: { backgroundColor: 'pink' },
getFilter: filter => {
// qualityFilter was assigned once the component has been mounted.
qualityFilter = filter;
},
onFilter: filterValue => {},
}),
},
];
render(
<BootstrapTable keyField="id" data={products} columns={selectColumns} filter={filterFactory()} />,