Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Resize CFWindow via JavaScript doesn't seem to work

New Here ,
Jul 05, 2010 Jul 05, 2010

Hi Folks

I'm trying to resize a CFWindow via Javascript when the Window is loaded (according to the size of the image, i'm displaying inside). It doesn't work and I spent hours of searching by now...

Here's my simplified version:

-------------------------------------------------------------------------------

"test.cfm"

-------------------------------------------------------------------------------

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
            /* <![CDATA[ */
                showWindow = function(){
                  ColdFusion.navigate('window-content.cfm', 'dummyWindow');
                    var objWindow = ColdFusion.Window.getWindowObject('dummyWindow');
                    if (objWindow.x < 0)
                      objWindow.x = 270;
                  if (objWindow.y < 0)
                      objWindow.y = 210;
                  objWindow.title = 'derp';
                 
                  ColdFusion.Window.show('dummyWindow');
                }
               
                resizeWindow = function(imgWidth,imgHeight){
                    var objWindow = ColdFusion.Window.getWindowObject('dummyWindow');
                    objWindow.height = imgHeight;
                    objWindow.width = imgWidth;
                }
            /* ]]> */
        </script>
    </head>
    <body>
        <cfoutput>
            <h2>Test</h2>
            <cfwindow name="dummyWindow" width="100" height="100" resizable="true" modal="true" />
            <a href="javascript:showWindow();">Show window</a>
        </cfoutput>
    </body>
</html>

-------------------------------------------------------------------------------

And...

-------------------------------------------------------------------------------

"window-content.cfm"

-------------------------------------------------------------------------------

<cfoutput>
    <!--- I want the window to have the image's size. I can read that with CFIMAGE --->
    <img src="dummy image" width="500" height="240" />
   
    <!--- Make cfsavecontent, because you can't use ajaxOnLoad() with arguments. --->
    <cfsavecontent variable="resizeHeadCont">
        <script type="text/javascript">
            /* <![CDATA[ */
                // let's pretend, i got 500 and 240 with cffile, action=read
                resizeWindow(500,240);
                alert('Code block is being executed, but no cfwindow-resize happened...');
            /* ]]> */
        </script>
    </cfsavecontent>
    <cfhtmlhead text="#resizeHeadCont#" />
</cfoutput>

-------------------------------------------------------------------------------

Does anyone know, why I can't set width and height of the window after it is shown for the first time? Shouldn't be that difficult to show an Image inside a CFWindow(?) But maybe I'm completely wrong after a long day of working.

I'm using CF9 Developer Edition on Windows 7 Ultimate 64-bit with IIS7.

Thanks for reading and maybe answering

Cheers

Boris

946
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2010 Jul 07, 2010
LATEST

Seriously... It works with:

objAWMapWin

.setSize(imgWidth, imgHeight);

It used to be setContentSize on CF8 and I'm using CF9 and I didn't get that one...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources