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

[DataGridPro] Hide OR operator option from the linkOperators in Multi-column filtering #3386

Closed
2 tasks done
Beslinda opened this issue Dec 9, 2021 · 5 comments · Fixed by #3497
Closed
2 tasks done
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature plan: Pro Impact at least one Pro user support: question Community support but can be turned into an improvement

Comments

@Beslinda
Copy link

Beslinda commented Dec 9, 2021

Order ID 💳

25719

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

I am using Multi-column filtering on data grid pro but I would like to hide the OR option for the time being. Is there a way to do this except with styling ?

The problem in depth 🔍

Hide GridLinkOperator.Or option from the link operators.

Context 🔦

No response

Your environment 🌎

`npx @material-ui/envinfo`
  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
    Memory: 858.14 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 15.1.0 - /usr/local/bin/node
    npm: 7.0.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.0 - /usr/local/bin/pod
    Gradle: 6.2.2 - /usr/local/bin/gradle
    Homebrew: 3.2.11 - /usr/local/bin/brew
    pip3: 20.3.1 - /usr/local/bin/pip3
    RubyGems: 3.0.3 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.21.1 - /usr/bin/git
    Clang: 11.0.0 - /usr/bin/clang
    Subversion: 1.10.4 - /usr/bin/svn
  Servers:
    Apache: 2.4.48 - /usr/sbin/apachectl
    Nginx: 1.19.5 - /usr/local/bin/nginx
  Virtualization:
    Docker: 20.10.10 - /usr/local/bin/docker
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.3
      System Images: android-26 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-R | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Atom: 1.58.0
    Nano: 2.0.6 - /usr/bin/nano
    Vim: 8.1 - /usr/bin/vim
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 1.8.0_242 - /usr/bin/javac
    Perl: 5.18.4 - /usr/bin/perl
    PHP: 7.3.29 - /usr/bin/php
    Python: 2.7.16 - /usr/bin/python
    Python3: 3.9.0 - /usr/local/bin/python3
    Ruby: 2.6.3 - /usr/bin/ruby
  Databases:
    SQLite: 3.28.0 - /Users/beslinda/Library/Android/sdk/platform-tools/sqlite3
  Browsers:
    Chrome: 96.0.4664.93
    Firefox: 74.0
    Safari: 15.1
  Monorepos:
    Lerna: 4.0.0

@Beslinda Beslinda added plan: Pro Impact at least one Pro user support: question Community support but can be turned into an improvement status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 9, 2021
@Beslinda Beslinda changed the title How to hide the OR from the linkOperators How to hide OR option from the linkOperators in Multi-column filtering Dec 9, 2021
@DanailH
Copy link
Member

DanailH commented Dec 10, 2021

Hi, @Beslinda thanks for raising this.

Yes, there is a way to remove the OR operator. It's done by extending the filter operators for a given type. You can check more about it here -> https://mui.com/components/data-grid/filtering/#extend-filter-operators.

@DanailH DanailH removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 10, 2021
@DanailH DanailH changed the title How to hide OR option from the linkOperators in Multi-column filtering [DataGridPro] How to hide OR option from the linkOperators in Multi-column filtering Dec 10, 2021
@DanailH DanailH changed the title [DataGridPro] How to hide OR option from the linkOperators in Multi-column filtering [DataGridPro] Hide OR operator option from the linkOperators in Multi-column filtering Dec 10, 2021
@alexfauquette
Copy link
Member

@DanailH I tried to add your explanation in the documentation, but I don't understand what do you want to override.

It seems that the "AND"/"OR" options in filter form are hardcoded

https://github.com/mui-org/material-ui-x/blob/389b9e64bec7b150763c4e23b259bd8e8814b722/packages/grid/_modules_/grid/components/panel/filterPanel/GridFilterForm.tsx#L200-L214

@destegabry
Copy link
Contributor

Order ID 💳: 29385

I have the same issue. I'm using server side filtering and my API supports only the AND operator, thus I need to remove the OR option.

I suggest adding a prop to list the available filters, something like gridLinkOperatorList: GridLinkOperator[].

@flaviendelangle
Copy link
Member

flaviendelangle commented Jan 4, 2022

#3497 do what you are proposing @destegabry but at the level of the FilterPanel

You will be able to do the following:

<DataGrid componentsProps={{ filterPanel: { linkOperators: ['and'] } }} />

@alexfauquette correct me if I'm wrong

@oliviertassinari oliviertassinari added component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature labels Jan 29, 2022
@Beslinda
Copy link
Author

Beslinda commented Feb 7, 2022

Do we know approximately when this #3497 will get merged ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature plan: Pro Impact at least one Pro user support: question Community support but can be turned into an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants