Skip to main content
1-Visitor
January 30, 2017
Solved

How to make a custom widget as responsive?

  • January 30, 2017
  • 1 reply
  • 5389 views

Hello,

We have created a custom widget which opens an image & we are doing some operations on that image.

We want that widget should be responsive. It should take all available space.

Can anyone please tell me how to do it?

Thanks & Regards,

Renuka Patil

Best answer by jkaczynski

Hello Renuka Patil​,

If I remember correctly you need to:

1. Add a property to your widget in the *.ide.js file:

this.widgetProperties = function () {

        return {

          // ...

          'supportsAutoResize': true,

          // ...

        }

}

2. Then in your *.runtime.js file you could relate to the property:

this.properties.ResponsiveLayout

Which should be equal to true, if the widget is placed in the responsive container.

3. And then you could:

  • implement the logic to consider the container size in the afterRender():

if(this.properties.ResponsiveLayout) {

     var width= this.jqElement.width();

     // ...

}

  • override the resize() function:

this.resize = function(width,height) {

     // invoked when widget is resized

}

Hope I don't forget something.

Regards,

J.

1 reply

1-Visitor
January 30, 2017

Hello Renuka Patil​,

If I remember correctly you need to:

1. Add a property to your widget in the *.ide.js file:

this.widgetProperties = function () {

        return {

          // ...

          'supportsAutoResize': true,

          // ...

        }

}

2. Then in your *.runtime.js file you could relate to the property:

this.properties.ResponsiveLayout

Which should be equal to true, if the widget is placed in the responsive container.

3. And then you could:

  • implement the logic to consider the container size in the afterRender():

if(this.properties.ResponsiveLayout) {

     var width= this.jqElement.width();

     // ...

}

  • override the resize() function:

this.resize = function(width,height) {

     // invoked when widget is resized

}

Hope I don't forget something.

Regards,

J.

rpatil-211-VisitorAuthor
1-Visitor
January 31, 2017

Hello Jakub,

Thanks for the reply.

I tried your suggestion, it is working fine.

Thanks & Regards,

Renuka

1-Visitor
January 31, 2017

Hi Renuka Patil​,

Glad that I could help. In case of any further questions, don't hesitate to ask here on Community.

Regards,

J.