Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Can I store these selected filters in a variable?

Is it possible to store these selected filters in a variable and have it updated as well when the use selects another set of filters? If so, how?

enter image description here

Codesandbox: https://codesandbox.io/s/muidatatables-custom-toolbar-forked-lrbf16

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To achieve that, you can use onFilterChange callback, like this :

const options = {
...

    onFilterChange: (column, filterList, type) => {
            const selectedFilters = this.extractFilters(filterList);
            console.log(selectedFilters);
          }
}

This function will be called everytime filter list changes.

Then, you declare function extractFilters which will extract all selected filters from passed filterList and it will return array object containting all selected filters :

 extractFilters = (filterList) => {
        let selectedFilters = [];
        filterList.forEach((filter) => {
          if (filter.length > 0) {
            selectedFilters.push(...filter);
          }
        });
        return selectedFilters;
      };

You can store this array in state.

Here is working example.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!