destroy cfwindow in javascript 'is not a function'
Posted
by Ryan French
on Stack Overflow
See other posts from Stack Overflow
or by Ryan French
Published on 2010-04-07T22:06:55Z
Indexed on
2010/04/07
22:23 UTC
Read the original article
Hit count: 436
coldfusion
|JavaScript
Hi All,
Having an issue here that I have tried everything I can think of but cant get it to work. I have a page with a link that creates a cfwindow like so
function create_window(ID){
var config = new Object();
config.modal=true;
config.center=true;
config.height=775;
config.width=700;
config.resizable=false;
config.closable=false;
config.draggable=false;
config.refreshonshow=true;
ColdFusion.Window.create('newWindow','Window Title', '/source/url'+ID, config)
The window is created and the URL has the ID parsed to it that is used for displaying the correct item in the window. This all works fine.
The problem is when I try and close the window and open a new window with a different item being displayed, the URL is not changed. I realise that this is because the window is being hidden, and not destroyed, and therefore it is the same window being opened. So I have created an onHide event handler to destroy the window like so.
function showItemDetails(){
var ID=document.getElementById("sList").value
create_window(ID);
ColdFusion.Window.onHide('newWindow', refreshList);
}
function refreshList(){
ColdFusion.bindHandlerCache['sList'].call();
ColdFusion.Window.destroy('newWindow',true);
}
Now when I close the window Firebug is returning the error "ColdFusion.Window.destroy is not a function" (In IE the error is "Object doesn't support this property or method"). I have made sure we are running the latest version of ColdFusion 8.01 on the server (as I know that .destroy wasnt added until 8.01) and have applied the latest hotfixes to the server as well.
Any ideas?
© Stack Overflow or respective owner