carbon-addons-iot-react icon indicating copy to clipboard operation
carbon-addons-iot-react copied to clipboard

[table] search callbacks not working

Open bjornalm opened this issue 3 years ago • 1 comments

What package is this for?

  • [x] React
  • [ ] Angular

Describe the bug

The Table search prop has two callbacks defined in the PropTypes definition and also mentioned in the documentation that do not work. It is the view.toolbar.search.onChange and the view.toolbar.search.onExpand. The onChange is overwritten in the TableToolbar.jsx and never works. The view.toolbar.search.onExpand works for the Table but not for the StatefulTable where the whole prop object view.toolbar.search is modified and the callbacks lost.

What strikes me here is that these callbacks should never have been placed in the view prop to begin with, they belong in the actions prop.

To Reproduce

Steps to reproduce the behavior:

Modify a Table story with search and try to use these callbacks

Expected behavior

  1. Not sure if we need or should expose the onChange since we already have the onApplySearch with the options.hasFastSearch that currently handles the different search scenarios. The callback should probably just be removed in order to not cause confusion or future bugs.
  2. The view.toolbar.search.onExpand should be deprecated and a new prop onSearchExpand should be added to the actions.toolbar prop instead. This prop should work for both the Table and the StatefulTable
  3. Docs and stories must be updated

Environment/versions:

  • OS: [e.g. MacOS, Windows]
  • Browser: [e.g. chrome, safari]
  • carbon-addons-iot-react version: [e.g. v2.60.0]

Additional context

If applicable, add screenshots to help explain your problem.

Add any other context about the problem here.

Specific timeline issues / requests

Do you want this work within a specific time period? Is it related to an upcoming release?

NB: The core contributors will try to work with your timeline, but it's not guaranteed. The earlier you make a request in advance of a desired delivery date, the better!

bjornalm avatar Feb 24 '22 10:02 bjornalm

@davidicus Do you agree with the expected behavior?

bjornalm avatar Feb 24 '22 20:02 bjornalm