question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SelectFilter formatter is not working properly

See original GitHub issue

By using multiselectFilter or selectFilter like below, the content of column ‘Category’ isn’t displayed and with selecting an option, no row is displayed.

bildschirmfoto 2018-09-26 um 15 05 03

Here is my code:

render() {
  const selectOptions = {
    0: 'A',
    1: 'B',
    2: 'C'
  };
  const columns = [
    {
      dataField: 'id',
      text: 'ID'
    },
    {
      dataField: 'category',
      text: 'Category',
      formatter: cell => selectOptions[cell],
      filter: multiSelectFilter({
        options: selectOptions,
      })
    }
  ];
  return (
    <BootstrapTable
      keyField='id'
      data={data}
      columns={columns}
      filter={filterFactory()}
    />
  );
}

Here is my source of how to use multiSelectFilter.

If I modify selectOptions to

const selectOptions = {
  "A": "A",
  "B": "B",
  "C": "C"
}

the filter works fine. bildschirmfoto 2018-09-26 um 15 04 42 So I think the formatter is not working as expected and searches for the key instead of the value in the table. This is what my json data looks like:

[{
  "id": 1,
  "category": "A"
}, {...}, {...}]

Do you have any idea how to fix this? Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AllenFangcommented, Oct 2, 2018

@NadineSch yes, you are right!

0reactions
NadineSchcommented, Oct 2, 2018

@AllenFang thanks for your fast reply. So you’re right with the formatter, my raw data is A, B or C and not 0, 1 or 2. Does that mean it’s necessary that the value i’m filtering for (A, B or C) is the key-attribute of the selectOptions-Object? Like:

const selectOptions = {
  A: 'Filter by A',
  B: 'Filter by B',
  C: 'Filter by C'
}

[key]: what I’m looking for in my raw Data [value]: how to name it in my filter-menu (?)

If I’m getting this right I’m clear now, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing formatter when using setColumns function in ...
setColumns() line, the local version works just fine and the formatter selectFilter works. The Tabulator version is 4.9. What would cause this?
Read more >
How to Solve "Filter Not Working" or Enable Filter in Microsoft ...
But sometimes filter doesn't work properly. ... Suppose your date range has a formatting like this 8-OCT and you are searching like this ......
Read more >
ffmpeg select filter only works properly after conversion to ...
ffmpeg select filter only works properly after conversion to same file format · Why is the original video not selecting or reading in...
Read more >
How to use Excel filtering to resolve file format errors
Right-click (or Control-click on a Mac) on the cell containing the data in error. On Windows, select Filter > Filter by Selected Cell's...
Read more >
Column Filter · react-bootstrap-table2 - GitHub Pages
Following is an example for custom select filter: import filterFactory, { selectFilter ... Note, the selectOptions can be an array or a function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found