Leon asked:

"I wondered if you know of a way to control the scroll position of the contents in a cfwindow? Do you know if there's some ext api function or property that can be used sort of like the JS scrollIntoView() type function, but applies to the ext window?"

The solution to the problem can be seen in the cfWindowScrollIntoView() function I created below

(click here to see this code working):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
   <title>CFWindow scrollIntoView()</title>
   <script language="JavaScript">
      cfWindowScrollIntoView = function(windowName,scrollTo){
         Ext.get(scrollTo).scrollIntoView(ColdFusion.Window.getWindowObject(windowName).body.id);
      }
   </script>
</head>
<body>
<form name="MyForm">
<input type="button" value="auto scroll" onclick="cfWindowScrollIntoView('MyWindow','pToScrollTo');">
</form>
<cfwindow
name="MyWindow"
center="true"
closable="false"
draggable="true"
height="300"
initShow="true"
minHeight="100"
minWidth="200"
modal="false"
refreshOnShow = "false"
resizable="true"
title="My Test Window"
width="400">

   click the button to auto scroll to the other section of content in this window
   <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    <p id='pToScrollTo'>Congratulations! you found the other content.</p>
</cfwindow>
</body>
</html>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Leon Chalnick's Gravatar Scott, thanks a bunch! Your efforts are much appreciated. This is working for me but I need to refine it a bit further. As it turns out, what the ext scrollIntoView() does is bring the identified element into view...specifically to the very bottom of the window body. I'd like it to scroll to the top of the window body so it's more easily seen by the end-user.

BTW, I used to run the Southern California CF User Group. I'm glad to see someone else has finally taken up the reins in the OC area. I'll look into your meetings and try to attend one soon.
# Posted By Leon Chalnick | 11/10/08 2:23 PM
Scott Bennett's Gravatar Leon,

change the javascript to be like this:

<script language="JavaScript">
   cfWindowScrollIntoView = function(windowName,scrollTo){
      win=ColdFusion.Window.getWindowObject(windowName);
      el=Ext.get(scrollTo);
      el.scrollIntoView(win.body.id);
      win.body.scroll('down',el.getTop()-win.body.getTop(),false);
   }
</script>
# Posted By Scott Bennett | 11/10/08 4:05 PM
Scott Bennett's Gravatar here is a sample with that new version of the function

http://www.coldfusionguy.com/ColdFusion/Samples/cf...
# Posted By Scott Bennett | 11/10/08 4:10 PM
Fabiano Magno Pechibella's Gravatar Hi Scott

I have a problem with the ext window and I dont know how I resolve this.

How put a ext window inside a cfform tag?

Example:
Called the page window.cfm
<ext:window id="settings" title="..:: Window ::.." width="500" height="200" iconCls="settings" modal="true" resizable="true" closeAction="hide" source="http://localhost:8500/window.cfm">;

How I call the ext window in a cfform tag in the event onSubmit?

This code:
This form post variables to a page.cfc
<cfform action="page.cfc?Method=Package" method="post" name="XMLl" onsubmit="window.open('','pop_up','width=400,height=290,left=250,top=250,screenX=350,screenY=-150');" target="pop_up">

How change the onsubmit=window.open to ext window.

Can you help me?

Tks
Hugs from Brazil.
Fabiano Magno Pechibella
# Posted By Fabiano Magno Pechibella | 4/11/13 7:44 PM