DDX Bricks: domo.onFiltersUpdate () and impact on page filters

pimogo
pimogo Member

Hello Domo Community,

I am seeking assistance with an issue I am encountering while using the domo.onFiltersUpdate() method in my Domo app. My goal is to make my app reactive to page filters, ensuring that the data and visualization are updated accordingly when filters are applied or changed on the page.

Issue:While the domo.onFiltersUpdate() method allows me to listen for filter updates and re-fetch data accordingly, it seems to prevent the default refresh behavior of the app. This is problematic because I need the app to refresh when page filters are applied.

Question:

  • How can I ensure that my app still respects the page filters and refreshes the data and visualization accordingly when using domo.onFiltersUpdate()?
  • Is there a way to manually trigger a refresh or handle the filters in such a way that it mimics the default behavior while still allowing for custom handling?

Any insights, suggestions, or examples of how others have tackled similar issues would be greatly appreciated. Thank you in advance for your help!

Best Answer

  • ArborRose
    ArborRose Coach
    Answer ✓

    I would think that filtering would limit the incoming dataset before any of the brick code occurs. From that point, it would be up to your code in JavaScript to deal with the changes. Order of processing. It seems like you are trying to put a condition on the code that might be trying to put back data that isn't there at the time of your event.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

Answers

  • If your brick dataset is on dashboard with filters against the same dataset, it should filter on its own. Filters must have the same field name. And Javascript is case sensitive..make sure you type the field names exactly the same.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **

  • pimogo
    pimogo Member
    edited July 22

    Thanks for your response! I suspected the same, but when I include this function, the natural page filtering stops working. For context, I'm using the Hierarchy Org DDX Brick from the Apps section and enhancing its functionality. My goal is to enable automatic expansion to the child nodes based on what filter is used or last used. However, this enhancement is causing the page filtering to fail.

    function updateExpansionLevel(filters) {
    let expandLevel = '0';
    const filterColumns = filters.map(f => f.column);

    if (filterColumns.includes('Filter3')) {
    expandLevel = '3';
    } else if (filterColumns.includes('Filter2')) {
    expandLevel = '2';
    } else if (filterColumns.includes('Filter1')) {
    expandLevel = '1';

    }

    expandByRank(expandLevel);
    }

    // Listen for filter updates
    domo.onFiltersUpdate(filters => {

    updateExpansionLevel(filters);

    });

    Thanks!

    h

  • ArborRose
    ArborRose Coach
    Answer ✓

    I would think that filtering would limit the incoming dataset before any of the brick code occurs. From that point, it would be up to your code in JavaScript to deal with the changes. Order of processing. It seems like you are trying to put a condition on the code that might be trying to put back data that isn't there at the time of your event.

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **