Mui-datatables: searching value in a Column not working when its searchable is set true and display set false

Created on 26 Mar 2019  路  6Comments  路  Source: gregnb/mui-datatables

searching value in a Column not working when its searchable is set true and display set false

i have 10 columns with its options,
i want to display only 5 columns is my view so other columns i have set display:"false",
but for all columns searchable is set "true",

Expected Behavior

I need the search to work even the column display is false.

Current Behavior

turns out even though searchable is set true if display is false ,search wont work

Steps to Reproduce (for bugs)

1.
2.
3.
4.

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | |
| MUI-datatables | |
| React | |
| browser | |
| etc | |

wontfix

Most helpful comment

same problem

All 6 comments

same problem

hi, this is a serious issue ,please help

Please post a reproducible example. In order to try to tackle these bugs there isn't enough time to recreate so I will need your help in posting a codesandbox. That will allow make it easier for others to look at the issue and potentially submit a fix. Thank you for understanding.

This sounds like intentional functionality to me. When the column is not visible, I would not expect the user to receive results from it. Otherwise, how can they tell where those results came from? It's surprising UX behavior, and should not be default in my opinion.

However, you have the ability to customize search however you wish via the customSearch function. See the customize-search example for a demo use.

@sanjanaHE @leducsang97
I leave here how I did it, then it would be improvising depending on how you show the columns, such as if you have more columns than data

sorry for my english

            customSearch: (searchQuery, currentRow, columns) => {
                let isFound = false;
                columns.forEach((col, i) => {
                    if (col.searchable) {
                        if (currentRow[i].toString().indexOf(searchQuery) >= 0) {
                            isFound = true;
                        }
                    }
                });
                return isFound;
            },

edit: by default, all columns has searchable = true, you need change all columns to searchable: false and let in true the columns that you need to search

edit: by default, all columns has searchable = true, you need change all columns to searchable: false and let in true the columns that you need to search

are we sure searchable: false works?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

geekashu picture geekashu  路  3Comments

kylane picture kylane  路  3Comments

JordanKadish picture JordanKadish  路  4Comments

demoreno picture demoreno  路  4Comments

Aankhen picture Aankhen  路  3Comments