Naotho Machida
Naotho Machida

Reputation: 3

MUIDataTables - Search always open

I'm using this lib https://github.com/gregnb/mui-datatables in react

My options:

const options = {
    customSearchRender: debounceSearchRender(500),
    searchOpen: true,
    // disable search icon
    search: false,
}

The icon search is disabled and search input init open

but when I click on viewColumns icon the search input closes

How I can prevent the search input never close?

Upvotes: 0

Views: 1761

Answers (1)

95faf8e76605e973
95faf8e76605e973

Reputation: 14191

The "Search always open" functionality for MUI-Datatables is currently open for pull requests as of this writing (August 11, 2020) as seen here and here. One of the contributors has suggested the use of a custom toolbar as a workaround so you can have a custom search bar that is always open.

In addition, another workaround is to always have some text inside the search bar - this seems to prevent its closure (e.g., a white space). Moreover, they have a prop that is invoked when the search bar is closed, you can probably make use of this to do something when it does close.

onSearchClose: ()=>{
  //some logic
}

Upvotes: 1

Related Questions