You need to sign in to do that
Don't have an account?
Dylan Gerow
Automatically Resizing a Canvas App in Visualforce Page
I am implementing a canvas app into a visualforce page and would like for it to automatically resize based on whether someone is on mobile, different browser window size, etc. I checked the Canvas Developer's guide which says to use the autogrow feature for canvas apps you only need add the following code:
However, when I add this to my visualforce page, nothing happens, and the size of the visualforce page remains default. I have included my visualforce code below:
Thanks
// Turn on auto grow with default settings. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.autogrow(sr.client); });
However, when I add this to my visualforce page, nothing happens, and the size of the visualforce page remains default. I have included my visualforce code below:
<apex:page controller="connectDataController" showHeader="false" sidebar="false" standardStylesheets="true" docType="html-5.0" language="en-US" applyHtmlTag="false"> <apex:canvasApp canvasId="mycanvas0" developerName="x" id="mycanvas0" scrolling="yes"/> <script> // Turn on auto grow with default settings. Sfdc.canvas(function() { sr = JSON.parse('<%=signedRequestJson%>'); Sfdc.canvas.client.autogrow(sr.client); }); </script> </apex:page>Any ideas as to why this isn't working properly?
Thanks
have you tried to put the autogrow code into your canvas app ?
Also, try to put the maxHeight="infinite" param to your canvas app tag,
in order to allow visual force page to grow beyond 2000px limit.
https://developer.salesforce.com/docs/atlas.en-us.platform_connect.meta/platform_connect/canvas_app_autogrow_code_example.htm?search_text=autogrow