function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Thomas Thejn 8Thomas Thejn 8 

How do I automatically resize CanvasApp when using force:canvasApp in a Lightning component

I have added a Ligtning component that displays a CanvasApp using the force:canvasApp
<force:canvasApp developerName="SalesValue_local_dev" scrolling="yes" width="1280" maxWidth="infinite" parameters="{!v.setMeOnInit}" />

I would like to resize the canvasApp automatically using the with of the compoentent, but I can not find the solution for this when using force:canvasApp. 

I have found this guide: 
https://developer.salesforce.com/docs/atlas.en-us.platform_connect.meta/platform_connect/canvas_app_resize_code_example.htm
But I don't know where to put this code or if it works for Lightning components?

I have also tried to add this code: 
<aura:attribute name="width" type="String" />
<force:canvasApp developerName="SalesValue_local_dev" scrolling="yes" width="{!v.width}" maxWidth="infinite" parameters="{!v.setMeOnInit}" />
But it does not work.