Ramtin Ghassemi
02/21/2024, 8:57 PMRamtin Ghassemi
02/21/2024, 10:05 PM<Dashboard />
component, instead of passing the dashboard prop as idRef(dashboardId)
if we just pass the dashboardId string, it doesn't make the re-renders. I'm just not sure why that is. From the source, it seems like ifRef just wraps the dashboardId in an object. If anyone has any ideas I'd really appreciate it.Radek Novacek
02/22/2024, 9:23 AMRadek Novacek
02/22/2024, 10:38 AMRamtin Ghassemi
02/27/2024, 9:21 PMRamtin Ghassemi
02/28/2024, 12:36 AM<Dashboard />
component. There are a default set of filters applied from the filterContext, but we would like users on our application to be able to set their own filters and for the filter to not go away after the page refreshes. So different users should be able to have different filters on the same dashboard embedded in our application. It seems like this is not natively possible, a work around I am thinking of is to somehow collect the filter state per user and save it in our database. I would like to be able to save this filter configuration per user, and pass them as props to the <Dashboard />
component to change the filters dynamically per user. Is this a possibility? I don't see any props to change filter state in the application without creating a filter context first. I'm not even sure of the correct way to collect the filters and handle changes. Ideally, we'd be able to save some json configuration for the user and pass that to the dashboard component. Thank you for your help!Radek Novacek
02/28/2024, 8:49 AMRadek Novacek
02/28/2024, 3:13 PM/*
* Specify dashboard to render; you can specify the dashboard either by reference (ObjRef) or
* by value (of type IDashboard).
*
* @remarks
* As a convenience, you may also specify a dashboard object
* identifier - this is same as using idRef(objectIdentifier).
*
* If you do not specify dashboard to render, a new default empty dashboard will be rendered.
*/
dashboard?: string | ObjRef | IDashboard;
Provide already loaded IDashboard and put filterContext directly into it. Then the place where you would store custom per user filterContexts is up to you.
Or you can provide custom filterContext via its ref:
/*
* Specify reference to a filter context that should be used instead of the default,
* built-in filter context.
*
* @remarks
* Note: this property only makes sense if you also specify dashboard by reference. If you specify
* dashboard by value, then the component assumes that the value also contains the desired filter context
* and will use it as is.
*/
filterContextRef?: ObjRef;
Then custom filter context itself needs to be stored directly in our MD server and you can store only mapping between the user and the customFilterContext ref on your side.
Realistically, this whole implementation may be a good time to look into whether Dashboard plugins would fit your use-case as well 🙂Ramtin Ghassemi
02/28/2024, 4:27 PMFilterBarComponent
prop but I was wondering if there are any other ways also. Thank you again!Radek Novacek
02/28/2024, 4:38 PMRamtin Ghassemi
02/28/2024, 4:43 PMAlex Martinez
03/26/2024, 5:35 PMSo we actually found a workaround for this. When rendering anow, we are struggling with the same issue withcomponent, instead of passing the dashboard prop as<Dashboard />
if we just pass the dashboardId string, it doesn’t make the re-renders. I’m just not sure why that is. From the source, it seems like ifRef just wraps the dashboardId in an object. If anyone has any ideas I’d really appreciate it.idRef(dashboardId)
filterContextRef={idRef(filterContextId)}
, this time the workaround of using the id as a string doesn’t work. We need explicitly to use idRef
and this makes the dashboard rerender on every react render. Any help on this? Thanks