Removing The Shadow From A CFWindow (And Something To Watch For)

Posted By : todd sharp Posted At : December 3, 2008 10:42 PM Posted In: Ext, Ajax, ColdFusion

0

I received what seemed like a pretty simple question today given my background with ColdFusion 8 Ajax:

I've been looking for a way to simply eliminate the shadow on a cfwindow. The closest thing I could find so far is in your example of using ext to fade the window in/out, but is there a way I could do it with just css since I don't need the fade effect?

So my first thought was to tap into the underlying ExtJS object that is returned by calling the ColdFusion.Window.getWindowObject() function. I checked the Ext docs and found a simple parameter for the BasicDialog to toggle off the shadow. I threw a quick test into CFEclipse and verified that it worked and replied to simply call the following code onLoad:
<script>
noShadow = function(){
    var w = ColdFusion.Window.getWindowObject('myWindow');
    w.shadow = false;
}
</script>
However, he wrote back and noted a very odd behavior where the shadow was actually 'disconnected' from the window, but remained in the original spot when the window was dragged. Here's what it looks like: cfwindow shadow I looked at his code, and the only difference I noticed was that he had used the 'initShow' attribute of cfwindow, and my code did not. A simple mod to the code to remove the initShow and manually show the window after the shadow was removed fixed the issue up. Seems that the shadow gets stuck once the window is shown - but if its removed before the window is shown everything is ok. Here's the complete code:
<html>
<head>
<script type="text/javascript">
noShadow = function(){
    var w = ColdFusion.Window.getWindowObject('myWindow');
    w.shadow = false;
    ColdFusion.Window.show('myWindow');
}
</script>
</head>

<body>
<cfwindow name="myWindow" initShow="false" title="Howdy Earth" closable="true" draggable="true">
    <p>Hello World</p>
</cfwindow>
<cfset ajaxOnLoad("noShadow") />
</body>
</html>

Comments (0)