8
Views
2
Comments
[Gridstack & Dashboard] Gridstack - How to use 'AddWidget' in the with chart?
gridstack-dashboard
Reactive icon
Forge asset by Arun Kumar
Application Type
Reactive

Hi,

I tried to implement a draggable/sortable dashboard with the following forge but it seems doesn't work. What I have tried is to to dynamically add a chart widget into the dashboard by passing the content in the existing data action (demo app) but the chart keeps showing loading shimmer in the widget. I wanted to try out the "AddWidget" function but doesn't know how to implement it 
Tried putting the element nor elementId works for the el, keep returning error. If anyone has successfully used addWidget() to dynamically insert charts or other widgets, I  appreciate some guidance or a working example. 

Regards,

Kenny

2025-08-07 06-30-56
Amit J
Champion

The addWidget() function typically expects a DOM element or element ID that is already rendered. If you're passing in a widget that hasn't been rendered yet (e.g., part of a dynamic list or conditional block), it won't work — and that’s likely why you’re getting a loading shimmer or error.

Make sure: The element you're referencing already exists in the DOM.

If you're using elementId, it should not include # and must match the actual HTML id of a container that holds your chart or widget.

2025-08-07 06-30-56
Amit J
Champion

It would be great if you can share the sample oml or error snap to identify more exact caused.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.