Attaching DIV to a window

Hello,



Just a quick question. I have a button that opens a window and attaches a div to this. However when I close the window and click the button again it fails with the following message.



uncaught exception: [Exception… “Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80004003 (NS_ERROR_INVALID_POINTER)” location: “JS frame :: localhost/Axscend-Portal/v4/dhtm … windows.js :: anonymous :: line 87” data: no]



Is this because the div is removed from the original document when attached?



Scott

Hello,

>> Is this because the div is removed from the original document when attached?

Right, you may use hiding window instead of closing like this:

dhxWins.window(id).attachEvent(“onClose”, function(win){win.hide();});

and then when you clicks the button just add:

if (!dhxWins.window(id)) {
    // create window first time
} else {
    // just show
    dhxWins.window(id).show();
}