Skip to main content
Fernis
Inspiring
September 18, 2008
Question

How to control CFLAYOUT height inside CFWINDOW?

  • September 18, 2008
  • 2 replies
  • 2005 views
Hi folks. I've been battling with a problem for a while. I want to use CFLAYOUT tags within CFWINDOW. Now, this works just fine and dandy, except that CFLAYOUT does not know the size of the CFWINDOW.

Thus, if you use CFLAYOUT wihthin a CFWINDOW, you are likely getting scroll borders for the window. I can manually set the CFLAYOUT size with the style attribute for sure to get rid of the problem, but static sized windows aren't really cool...

How could I make the CFLAYOUT automatically resize according to the CFWINDOW size? I've tried to use the ColdFusion.Window.getWindowObject() but I haven't been able to succesfully touch the ExtJs's basicElement object properties...

Here's some code samples to start with. Hope it doesn't have too many typos, since I altered the code somewhat before posting...

index.cfm :

<script>
function destroyWindow(name) {
ColdFusion.Window.destroy(name);
}

function resizeWindow(name,width,height){
alert(width+' '+height);
// name is an object. Now what? How do I extract the object name or Id .. and
// how to dig out the correct id's, the style of which I want to change...?
}

function newTestManager() {
i = Math.random();
ColdFusion.Window.create('testManager'+i,'Test Manager','testmanager.cfm',{width:800,height:500})
ColdFusion.Window.onHide('testManager'+i, destroyWindow);
win = ColdFusion.Window.getWindowObject('testManager'+i);
win.on('resize',resizeWindow);
}
</script>

<a href="javascript:newTestManager()" id="newTestManager">Test Manager</a>

--

testmanager.cfm:

<cflayout type="border" style="height:470px;width:786px">
<cflayoutarea splitter="true" size="190" minsize="100" maxsize="400" name="tmleft" position="left" source="testmanager.left.cfm">
</cflayoutarea>

<cflayoutarea position="center" name="tmcenter" source="testmanager.center.cfm">
</cflayoutarea>
</cflayout>

--

create testmanager.left.cfm and testmanager.center.cfm - might be empty files as well.

Try leaving out the cflayout style attribute, and see what happens if you omit that. You might also try to open a smaller CFWINDOW if the problem doesn't highlight otherwise.

I'm sure many others would appreciate a solution to this. Thanks!
    This topic has been closed for replies.

    2 replies

    Fernis
    FernisAuthor
    Inspiring
    September 19, 2008
    True, it was my bad that I was using a version of ColdFusion where the CFLAYOUT doesn't automatically size to the CFWINDOW size. In 8.0.1 it works correctly.

    However, the CFLAYOUT won't resize when I resize the CFWINDOW, and that's the main problem still :-( I think it requires hacking into the Ext framework, and that's beyond me, although I've tried hard.

    -Fernis


    Inspiring
    September 21, 2008
    Here is an example from the Coldfusion Guy. See the last example...

    Ken
    Fernis
    FernisAuthor
    Inspiring
    September 22, 2008
    The problem in your solution is that it will update the whole body contents, washing away the cflayoutareas and everything... I practically got everything right myself this far. At the most granular level, my problem is now how to dig into the underlying Ext styles and update the window content so that the cflayout's height updates. Can I somehow know the ID of the layout, or can I dynamically get the object somehow regardless of the ID?

    I know this is a tough one. Thanks for trying to help! :-)
    Inspiring
    September 18, 2008
    You could not have any size on the cflayout at all and it would then size to the contents

    Or

    <cflayout type="border" style="height:100%;width:100%">

    I would also recommend using the style height/width for cflayoutarea as well.

    Ken