Dynamic list in dynamic pages, filtered by dynamic value?

jenmagjen
jenmagjen Member Posts: 11

Hi, what I'd like to achieve in a dynamic page (CollectionA), is to show a list(CollectionB) filtered by a value from the collection(CollectionA). The intuitive way of doing this, would be to add {{dynamic_value}} as the filtering value.

Is this possible somehow? I looked into dev mode, but it seems the filter is handled in a encrypted string or stored somewhere else.


Answers

  • Elizabeth_Fedak
    Elizabeth_Fedak Member Posts: 83 MVP

    Hi @jenmagjen This is possible with a custom widget. In the example below, there is a dynamic page for each member of a team. On each team member's page, it dynamically filters the collection again to find all of the teammate's who have the same manager and displays those as their team/cohort. You could do the same thing with 2 different collection as long as you have a value to join them on. i.e.


    Table A: Students

    Name, Age, Teacher's Name

    Table B: Teachers

    Name, Students, Subject

    You could join Table A to Table B based on the teacher's name and display the subject for that student. (A bit convoluted of an example for a Duda site I'm assuming, but just trying to show the option.)

    You would set up the fields of a custom widget this way:

    1. Add a list input and all of the normal values. Use JavaScript to dynamically add those cards to the page after being filtered. This is a great library for that but requires JS knowledge - https://listjs.com/

    2. Add a text field and make it connect to data dynamically. This will be the field that you are filtering on. It must match a field from the list. In the JavaScript code you'd do something like this:

    let filteredTeam = data.config.teammateList.filter(x => x.whoseTeamAreYouOn === data.config.currentTeam) to get the filtered list of results.

    That would trigger on each dynamically page uniquely for that page's person.


  • Tal_Levi
    Tal_Levi Member Posts: 2 Product Team

    Hey @jenmagjen! We're working on a new feature, Dynamic Filters, that will enable you to accomplish that without a custom widget or dev mode. You'll be able to map a field from collection B (connected to the widget) to a field in Collection A (connected to the dynamic page).

  • jenmagjen
    jenmagjen Member Posts: 11

    @Tal_Levi Thanks. Any idea when that will be available?

    May I also suggest dynamic popups... ;-)

  • Tal_Levi
    Tal_Levi Member Posts: 2 Product Team

    @jenmagjen It will be available in the upcoming weeks, will post an update in the discussion once it's released 🙂

    We're not planning to work on dynamic popups any time soon, but make sure to add the idea / upvote an existing one in our Idea Board! We take the requests into consideration when planning our roadmap.

  • Lesli
    Lesli Member Posts: 11