How to fix the default size of a widget deployed on cumulocity

What product/components do you use and which version/fix level are you on?

Cumulocity

Is your question related to the free trial, or to a production (customer) instance?

Free Trial

What are you trying to achieve? Please describe it in detail.

Hi, I have created a widget and deployed it on cumulocity as a web app. Now I know that you have to add a widget and initially it has a default size, but you have to resize it according to your needs. I want to know that if I can keep a default height and width of that widget so that whenever we add that widget into our dashboard, we don’t have to resize it. Please let me know what changes I need to make for the same, also point out to any docs if any.
Thank you in advance.

Hi Samanyu,

You can specify some widgetDefaults when registering the widget:

{
  id: 'acme.text.widget',
  label: 'Text widget',
  description: 'Can display a text',
  component: WidgetDemo,
  configComponent: WidgetConfigDemo,
  data: {
    settings: {
      noNewWidgets: false,
      widgetDefaults: {
        _width: 4,
        _height: 4
      },
      ng1: {
        options: {
          noDeviceTarget: true,
          groupsSelectable: false
        }
      }
    }
  }
}

The values for _width and _height are used for the grid layout of the dashboard.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.