Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken search functionality #181

Closed
netbrain opened this issue Jan 25, 2019 · 1 comment
Closed

Broken search functionality #181

netbrain opened this issue Jan 25, 2019 · 1 comment

Comments

@netbrain
Copy link
Contributor

    // Apply Search
    if (this.state && this.state.searchText) {
      renderData = renderData.filter(row => {
        let result = false;
        this.state.columns
          .filter(columnDef => { return columnDef.searchable === undefined ? !columnDef.hidden : columnDef.searchable })
          .forEach(columnDef => {
            if (columnDef.customFilterAndSearch) {
              result = !!columnDef.customFilterAndSearch(this.state.searchText, row, columnDef);
            }
            else if (columnDef.field) {
              const value = this.getFieldValue(row, columnDef);
              if (value && value.toString().toUpperCase().includes(this.state.searchText.toUpperCase())) {
                result = true;
              }
            }
          });

        return result;
      });
    }

The addition of the customFilterAndSearch functionality has partially broken the search functionality depending on where customFilterAndSearch is used.

If for instance customFilterAndSearch was the last column in the column definition list (worst case) then only this field would be included in the search logic as it would overwrite any results from previous findings.

I'll be submitting a patch shortly.

@mbrn
Copy link
Owner

mbrn commented Feb 1, 2019

v1.16.0 published

FalkF pushed a commit to FalkF/material-table that referenced this issue May 28, 2021
Added onMouseEnter and onMouseLeave listeners to action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants