patrickkunka / mixitup

A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more
https://www.kunkalabs.com/mixitup/
4.52k stars 734 forks source link

Multifilter with multiple dropdowns, reset between choices #577

Open spigotdesign opened 3 years ago

spigotdesign commented 3 years ago

Hoping someone can help as I try to implement multifilter with multiple dropdowns. Here's what I'm trying to do:

Three dropdowns with completely separate lists. The selections can not be additive. When a user selects from one of the three dropdowns, the previously selected option gets reset, and the only activeFilter is the newly selected option.

I've been able to reset the select elements with javascript .change function, but can't figure out how to reset the current active filter.

Here's my script:

var containerEl = document.querySelector('[data-ref~="mixitup-container"]');

var mixer = mixitup(containerEl, {
    multifilter: {
        enable: true
    },
    animation: {
        enable: false
    },
    controls: {
        toggleLogic: 'or',
        //toggleFilterButtons: true
    },

    callbacks: {
        onMixStart: function(state, futureState) {
            console.log(futureState.activeFilter.selector);
        }
    }
});
//mixer.setFilterGroupSelectors('industry', '.wastewater');
mixer.setFilterGroupSelectors('wastewater', '.all-manufacturers-wastewater');

mixer.parseFilterGroups();

mixer.configure({
    animation: {
        enable: true
    }
});

This seems to be a similar issue as #474 but the OP solved it himself...

iecwebmast commented 3 years ago

Dear Mr. Hoffman, Thank you for your email. Please be kind to inform me what you are referring to. Do you have a technical inquiry regarding a specific standard? If this is the case, please provide us the reference number of the standard in question. Best regards,

Marcela Gómez Customer Service Representative

[International Electrotechnical Commission]http://www.iec.ch/

IEC - International Electrotechnical Commission | 3 rue de Varembé | PO Box 131 | CH-1211 Geneva 20 | Switzerland | T +41 22 919 0211 | e-tech magazinehttp://iecetech.org/ | websitehttp://www.iec.ch/ | webstore https://webstore.iec.ch/

From: Bryan Hoffman @.> Sent: Tuesday, 15. June 2021 21:46 To: patrickkunka/mixitup @.> Cc: Subscribed @.***> Subject: [patrickkunka/mixitup] Multifilter with multiple dropdowns, reset between choices (#577)

Hoping someone can help as I try to implement multifilter with multiple dropdowns. The three dropdowns are completely separate lists, so I don't want the selections to be additive. I'd like when a user selects from one of the three dropdowns, the previously selected filter gets reset, and the only activeFilter is the newly selected option.

I've been able to reset the select elements with javascript .change function, but can't figure out how to reset the current active filter.

Here's my script:

var containerEl = document.querySelector('[data-ref~="mixitup-container"]');

var mixer = mixitup(containerEl, {

    multifilter: {

           enable: true

    },

    animation: {

           enable: false

    },

    controls: {

           toggleLogic: 'or',

           //toggleFilterButtons: true

    },

    callbacks: {

           onMixStart: function(state, futureState) {

                   console.log(futureState.activeFilter.selector);

           }

    }

});

//mixer.setFilterGroupSelectors('industry', '.wastewater');

mixer.setFilterGroupSelectors('wastewater', '.all-manufacturers-wastewater');

mixer.parseFilterGroups();

mixer.configure({

    animation: {

           enable: true

    }

});

This seems to be a similar issue as #474https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpatrickkunka%2Fmixitup%2Fissues%2F474&data=04%7C01%7Csales%40iec.ch%7Ce91e4ff98c58480cfc9a08d9303636e6%7Ca7637f093d864148997bedcd40bee856%7C0%7C0%7C637593831679779686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=jDMY2gzBhTAiB%2FYXPETcgS2T0BYrWJpYqPzoxEX%2FUec%3D&reserved=0 but the OP solved it himself...

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpatrickkunka%2Fmixitup%2Fissues%2F577&data=04%7C01%7Csales%40iec.ch%7Ce91e4ff98c58480cfc9a08d9303636e6%7Ca7637f093d864148997bedcd40bee856%7C0%7C0%7C637593831679779686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yuWMAxbUloNIwvYVwszCEN8EJY06dJMlRm6mdeTA8GY%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABMNT4TIHI7R7YHQHIMY3PTTS6UXZANCNFSM46X5TQCQ&data=04%7C01%7Csales%40iec.ch%7Ce91e4ff98c58480cfc9a08d9303636e6%7Ca7637f093d864148997bedcd40bee856%7C0%7C0%7C637593831679789645%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9%2Ff5hBjURAxCwo6oCIMWJYiuf8dH9t5z9HDrIdCqPXc%3D&reserved=0.