1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / dialogBase.resizeToContent()

dialogBase.resizeToContent()

4 posts, 0 answered
  1. Jeff
    Jeff avatar
    11 posts
    Registered:
    23 Aug 2011
    22 Sep 2011
    Link to this post
    My control designer is not resizing based on the size of the contents, (including a dynamically updated RadGrid), even when I explicitly add "dialogBase.resizeToContent()" after the script which triggers the elements to change size.  Even the initial size seems off for the empty grid. 

    I am curious how "resizeToContent" works.  Do I have to have a specific type of content in the control in order for it to work (such as "block" type elements only at the top level)?

    Do I have to use CSS to size the contents ahead of time, perhaps?
  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    22 Sep 2011
    Link to this post
    Hello Jeff,

    Could you send us the source for your designer so we could examine it and see what happens? Do you get any Javascript errors during the loading/showing of your designer in the dialog?

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Jeff
    Jeff avatar
    11 posts
    Registered:
    23 Aug 2011
    23 Sep 2011
    Link to this post
    I can't send my source, and it would be too complicated to get it running anyway, as it relies on non-public web services.

    However, I am interested in general knowlege about this topic, such as how the "resizeToContent" works, what kind of content has to be present, and how it interacts with sizes specified in CSS.  Is there a best practice for creating the content so that "resizeToContent" will work correctly, and the control will be sized correctly initially?  Also, is there any reference material on the subject, or examples you can point me to?
  4. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Sep 2011
    Link to this post
    Hi Jeff,

    The resizeToContent function is based on RadWindow. Since its contents is inside an IFRAME, the browser is able to calculate the needed amount of space required to display all the elements in the nested IFRAME document, so the function basically resizes the IFRAME wrapper.

    You could see the source of this function if you load Telerik.Sitefinity.dll with a tool like Reflector and navigate its resources to Telerik.Sitefinity.Web.Scripts.AjaxDialogBase.js - there is the function

    resizeToContent: function (oWnd) {
      ...
    }

    Best wishes,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered