0

I am building a dashboard using reactiveSearch that contains some filters (MultiList) say Countries, Status etc. And I have a table with some rows rendered in reactiveList.

I have a toolbar which I am using to change particular properties on the table. For example if I need to change the status of the row from pending to on-Hold (This toolbar is not a reactiveSearch component). Based on the feedback from the status change call how do I rerender the reactiveBase component to update the count and update the row to reflect the updated status.

Couple of options I tried is 1) Set the MultiList filter value to random while the status update is happening and to the actual value back when the status update is completed so as to trigger a rerender. But this is not updating the count of the filters. And also the status of the table rows is not consistently updating.

2) reload the webpage (this works but want to save it as a last resort)

// reactjs

<MultiList
   componentId="stateFilter"
   dataField="state"
   value={this.state.stateValue}
   onChange ={this.onChange}
   ...
 />

shouldComponentUpdate(nextProps, nextState) {
    if(this.props.isStateSaving && !nextProps.isStateSaving) {
      this.setState({ stateValue : [] });
    } else {
      this.setState({ stateValue : ['All States'] });
    }
    return true;
  }

Expected result is when state is saved, the count of filter and table row should be update to reflect the actual state.

sunny
  • 49
  • 1
  • 1
  • 3

1 Answers1

0

If you want to update the Results based on the value of the filter, you can use react prop which updates the Result based on the values inside react prop. For a better understanding of this prop, you can read docs here. If this is not what you are looking for it would be better if you can provide a CodeSandbox or CodePen link.

Hope this Helps!

Yash Joshi
  • 2,586
  • 1
  • 9
  • 18
  • Thanks for the response Yash. I don’t want to update based on reactivesearch (component) filter. There is a external toolbar (not a reactivesearch component) that does some data manipulation like changing current status or change current assigned user for selected record in the table. Once the record is updated, I want to force rerender to update the count of the filters and the table results too. Is it possible to reference non reactiveSearch components with react prop?? I can create a CodePen and post it. – sunny Jul 18 '19 at 00:20
  • It would be great to have a CodePen or a CodeSandbox link. You cannot use `react ` prop with a non ReactiveSearch Component. – Yash Joshi Jul 18 '19 at 06:51