Filter section but not dashboard

Hello,

I have implemented a filter for a section using the getFilters  method which works fine on the Section page, but should not apply to the dashboard page. Is there a way to have the filter apply only to the Section grid but still leave the dashboard unfiltered?

Like 0

Like

1 comments

Not sure if this will work, but you could maybe try checking in the getFilters method which view the user is on, and if it's the dashboard view then don't apply the filter? Never tried this so not sure if it's too late at that point (or if it retrieves the data again when switching views or not)

To check if user is viewing dashboard view:

if (this.getActiveViewName() === "AnalyticsDataView") {
    // user is on dashboard view
}

I think you can override changeDataView to force it to reapply the filter (and retrieve data again). Something like this: 

changeDataView: function() {
    this.callParent(arguments);
    if (this.getActiveViewName() === "AnalyticsDataView") {
        this.sandbox.publish("ReloadDashboard", null, [this.sandbox.id + "SectionDashboardDashboardModule"]);
    }
    else {
        this.updateSection();
    }
}

Ryan

Show all comments