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

Issue-857 Server Side Filters #913

Merged
merged 13 commits into from
Oct 3, 2019

Conversation

gabrielliwerant
Copy link
Collaborator

Attempt to resolve #857 as well as any other requests around the difficulty of achieving server side filter functionality.

Handling filters on the server side is not an experience that has been optimized in this library. Some of the problems are:

  • Lack of callbacks for the filter dialog, preventing different kinds of interactions with external APIs
  • filterList in column options is connected to both the change in the fields in the filter dialog as well as the filter chip display, meaning that the display of applied filters cannot be stalled until a successful API call (they will be applied immediately regardless of any success/failure from an API call)
  • Lack of ability to add custom buttons/functionality to the filter dialog

Here are the solutions offered in this PR:

  • onFilterDialogOpen and onFilterDialogClose callbacks are added for opening and closing the filter dialog respectively
  • serverSideFilterList option has been added to track the display of filterList as chips (array of filter arrays, as structured internally). When serverSide is set to true, filter chips will no longer populate as before, and will require serverSideFilterList to populate.
  • customFilterDialogFooter option added to allow a custom component to be added to the bottom portion of the filter dialog for custom functionality, such as an "Apply Filters" button

The example serverside-filters was added to demonstrate the use of some of these features to create a serverside filtering experience.

@coveralls
Copy link

coveralls commented Sep 11, 2019

Coverage Status

Coverage decreased (-0.01%) to 76.622% when pulling 270578b on enhancement/issue-857-server-side-filters into f0ea9e5 on master.

…o enhancement/issue-857-server-side-filters

# Conflicts:
#	README.md
#	test/MUIDataTable.test.js
#	webpack.config.js
@gabrielliwerant gabrielliwerant merged commit dcf7857 into master Oct 3, 2019
@gabrielliwerant gabrielliwerant deleted the enhancement/issue-857-server-side-filters branch October 3, 2019 06:11
waqasajaz pushed a commit to waqasajaz/mui-datatables that referenced this pull request Oct 31, 2019
* Add onFilterDialogOpen callback when filter dialog opens

* Add customFilterDialogFooter for adding a footer to filter dialog

* Allow filter chips update to trigger separate filter update type

Add type to onFilterChange callback to allow differentiation among filter types, adding a "reset" type for filter reset

* Minor enhancements

* Add serverside filter example

Uses all of the additional functionality to create a new filter experience for serverside use cases

* Add tests for major functionality additions

- filterList
- customFilterDialogFooter
- onFilterDialogOpen

* Fire onFilterDialogOpen after setState for consistency with other callbacks

* Add serverSideFilterList for chip display with serverside filters

* Add tests for serverSideFilterList

* Add onFilterDialogClose callback option

* Add test for onFilterDialogClose

* Add serverside filter example to new router setup
lalong13 pushed a commit to lalong13/mui-datatables that referenced this pull request Jan 15, 2020
* Add onFilterDialogOpen callback when filter dialog opens

* Add customFilterDialogFooter for adding a footer to filter dialog

* Allow filter chips update to trigger separate filter update type

Add type to onFilterChange callback to allow differentiation among filter types, adding a "reset" type for filter reset

* Minor enhancements

* Add serverside filter example

Uses all of the additional functionality to create a new filter experience for serverside use cases

* Add tests for major functionality additions

- filterList
- customFilterDialogFooter
- onFilterDialogOpen

* Fire onFilterDialogOpen after setState for consistency with other callbacks

* Add serverSideFilterList for chip display with serverside filters

* Add tests for serverSideFilterList

* Add onFilterDialogClose callback option

* Add test for onFilterDialogClose

* Add serverside filter example to new router setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using onBlur to activate the filter instead of using onFilterChange
2 participants