mdbootstrap / mdb-react-ui-kit

React 18 & Bootstrap 5 & Material Design 2.0 UI KIT
https://mdbootstrap.com/docs/b5/react/
Other
1.41k stars 264 forks source link

Access/Modify the search value of DataTable #68

Closed Heshan-Sandamal closed 5 years ago

Heshan-Sandamal commented 5 years ago

I'm using mdbreact 4.11.0 I need to clear the value of the search filed when new data is passed to the data table using the data prop. Currently the search value remains same although the data prop is modified. Currently the search value is defined as a state variable inside the local state of DataTable class. But there is no prop to access or modify the value of search filed or to set the default value of search field.

this.state = { activePage: 0, columns: props.data.columns || [], entries: props.entries, filteredRows: props.data.rows || [], pages: [], rows: props.data.rows || [], search: '', translateScrollHead: 0, order: props.order || [] };

I think we can have more control if the search value is exposed as a prop in DataTable class

Rotarepmi commented 5 years ago

Hello @Heshan-Sandamal,

Thanks for the request. I think it would be a good feature. We will consider to add it in the future release.

I'm closing the issue for now, you can follow up our changelog here: https://mdbootstrap.com/docs/react/changelog/

Best,

Jakub