Skip to main content
1-Visitor
Jan 30, 2017 10:47 AM UTC
Solved

How to make a custom widget as responsive?

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

1-Visitor
Jan 30, 2017 4:00 PM UTC

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.

5 replies

1-Visitor
Jan 30, 2017 4:00 PM UTC

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.

Translate
rpatil-211-VisitorAuthor
1-Visitor
Jan 31, 2017 5:07 AM UTC

Hello Jakub,

Thanks for the reply.

I tried your suggestion, it is working fine.

Thanks & Regards,

Renuka

Translate
1-Visitor
Jan 31, 2017 2:56 PM UTC

Hi Renuka Patil​,

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

Regards,

J.

Translate