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

How to control CFLAYOUT height inside CFWINDOW?

Enthusiast ,
Sep 18, 2008 Sep 18, 2008
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!
1.9K
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
Enthusiast ,
Sep 18, 2008 Sep 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
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
Enthusiast ,
Sep 19, 2008 Sep 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


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
Enthusiast ,
Sep 21, 2008 Sep 21, 2008
Here is an example from the Coldfusion Guy. See the last example...

Ken
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
Enthusiast ,
Sep 22, 2008 Sep 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! :-)
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
Enthusiast ,
Sep 22, 2008 Sep 22, 2008
I'm now confused at what you are trying to do ?

I have not tried the example I posted, but
resizeListener = function(myWindow,width,height){
whMsg = ("width: " + width);
whMsg = (whMsg + "\nheight: " + height);
myWindow.body.update(whMsg);
}

This code to me would only change the width and height.

But, I did a test (see attached code)
The cflayout resizes when the window is resized !!
The code is from the online docs, its a login window.
I just enclosed the form in cflayout/cflayoutarea tags.

Ken
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
Enthusiast ,
Sep 23, 2008 Sep 23, 2008
Your example differs from mine in the way that you are not using CFLAYOUT type="border", nor are you using CFLAYOUTAREA with position attribute. That's my main point: If you create that "frame-like" interface within a cfwindow, it will not resize.

Glad we're getting there ;-)
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
Enthusiast ,
Sep 23, 2008 Sep 23, 2008
LATEST
Sorry, still resizes correctly for me, see attached code.Same cfwindow as before, just change the content to a cflayout example from ColdfusionJedi

CFLayout Examples

Ken
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