Dynamic list in dynamic pages, filtered by dynamic value?

jenmagjen
jenmagjen Member Posts: 13

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: 106 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: 13 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: 13

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

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

  • Tal_Levi
    Tal_Levi Member Posts: 13 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: 13
  • Tal_Levi
    Tal_Levi Member Posts: 13 Product Team

    Hey everyone, Dynamic Filter is released!

    Excited to see how you use it 🙂

  • Elizabeth_Fedak
    Elizabeth_Fedak Member Posts: 106 MVP
    edited August 2022

    Hey @Tal_Levi I think this feature release might have broken custom widgets that use collections in the widget builder. (My thought is because there is a new query parameter that appears in list data types that didn't appear before, and I noticed it around the day Kia said this feature was implemented, and the widget builder stopped working that day.) When I add a second list and connect both lists to a collection, or separate collections, the second or additional lists are merged into the first and show properties from all data types in the editor and on the live site and an additional query property is added in by Duda. On the live site, any additional list using a collection shows up as null even if they are connected to data. (They do appear in the editor, however, and the merged properties show up in the editor.) I've had to use the API from Airtable to bring in my lists for the past 2 weeks due to this issue. For example, a list of people w/ a name and email property and a list of locations in one widget wind up getting merged such that the person object has a name, email, and location (w/ null value) property, and the location object has all of the properties from the person object, but in the live site, the person list would populate and the location list would show up as null.

  • Tal_Levi
    Tal_Levi Member Posts: 13 Product Team

    Hey @Elizabeth_Fedak, could you please contact support about this issue? We'll look into it and check if there's a connection.