How to access Data View context object in AnyChart widget On Click event?

0
I am building an actionable dashboard in Mendix using the AnyChart widget (Plotly-based). The dashboard shows a pie chart with project statuses: Completed WIP Not Started On Hold Each slice represents the count of projects for that status. When a user clicks on a slice (e.g., "Completed"), I want to trigger a microflow that retrieves projects for that status and shows them in a new page.   Current Setup:   I have a non-persistent entity Dashboard that holds all preloaded project lists (status-wise). The AnyChart widget is placed inside a Data View bound to this Dashboard object. The chart data is generated dynamically from this Dashboard object. In the widget’s Events tab, I configured: Event entity: TaskManager.AnyChart (to store click event JSON) Event data attribute: stores raw Plotly event data On click microflow: ACT_ProjectStatusDistribution Problem: In the On Click microflow, Mendix only passes the Event entity object (with JSON data).Even if I select the same entity type (Dashboard) as the Event entity, Mendix creates a new instance instead of using the existing context object.So, I cannot access the original Dashboard object that contains all the preloaded project lists.   What I Need: When a user clicks on a slice, I need: The clicked status (from the event data). The existing Dashboard object (context of the Data View). Based on these, I will filter projects from the Dashboard and show them.   Questions: Is there a way to access the Data View context object in the On Click microflow or nanoflow? Can I pass both the Event entity and the Dashboard object to the microflow? If not, what is the recommended approach to achieve this? Should I use a nanoflow instead of a microflow? Or create a helper object to combine event data and context?    
asked
1 answers
0

hi,


This is expected behavior of the AnyChart widget.

The On Click microflow/nanoflow only ever receives the Event entity.

It cannot access the Data View context object, and selecting the same entity type will always create a new instance, not reuse the existing one.

What is NOT possible

  • You cannot access the Data View context (Dashboard) in the chart click microflow
  • You cannot pass both Event entity and Dashboard object to the same action
  • Switching microflow ↔ nanoflow does not change this behavior

Recommended (and correct) pattern

Do not preload project lists inside the Dashboard NPE.

Instead:

  1. Use the click event only to extract the status
    • Parse the status from the Event JSON (label, name, or customdata)
  2. Retrieve projects on demand
    • In the click microflow:
      • Use the extracted status
      • Retrieve Project objects directly from the database
      • Open the target page with the retrieved list

This keeps the chart stateless and avoids context issues entirely.

If you must keep a Dashboard object

  • Store the Dashboard object in:
    • Page parameter (opened page)
    • Or Session-level persistable helper entity
  • Retrieve it explicitly in the click microflow
  • (This is more complex and usually unnecessary.)



answered