problem with attachObject when using multiple times

Hi there,
I’m facing a problem with dhtmlxWindows (attachObject() method).
Here is my code.

html:

Company Name:
Procedure Sheet:

so, iam calling attach method from another table multiple times from same page, i.e

<%="+rs_stdReasons_data+""%>

it works fine first time but not from the second time. when i click second time i can see the window but content from div(id=obj) is not being attached.

Thanks in advance. Dileep

Hello,

after closing window its content removed. If you open the same window several times, it would be better to hide it instead. The example:

function openInWindow(obj) {
if (!dhxWins) dhxWins = new dhtmlXWindows();
if (!dhxWins.window(“w1”)) {
var w1 = dhxWins.createWindow(“w1”, x, y, w, h);
/this event is called when “close” button is pressed/
w1.attachEvent(“onClose”, function(w){
if (win.getId() == “w1”) {
/detaches object and attaches it to body/
win.detachObject();
/hides window/
win.hide();
}
});
} else {
/shows window/
var w1 = dhxWins.window(“w1”);
w1.show();
}
/attaches object/
w1.attachObject(obj);
}

Thanks a lot for your help. its working great.

I have got one more problem.

I have got one window(w1) that is configured with the settings on which is working fine.

So now I want to extend it to load with different values according to the different parameters.

Each time i click that window,layout will be the same and values should load dynamically from the server(for this i have got jsp that generates xml). Because, I’m attching an object(

-contains combo and grid in it) to the window. So, the combo and grid should load with different values when i call it from different places(I’m calling it through javascript mathod createWindow(“w1”))

// code will be something like this
function createWindow(win){
show(“win”);// which shows the raw window with settings that generated when onload().
dhxWins.window(win).attchObject(“obj”); // Object will be added with combo and grid.

// so from here is there any way to populate this with different values?.
// is it possible to clear previous values and generate again with new ones?.
}

Thanks in advance.

Hello,

if combo and grid must have different values, you may load new xml in grid and combo:

combo.clearAll(true);
combo.loadXML(…);

grid.clearAll(); /if you want to reload the header too, grid.clearAll(true);/
grid.loadXML(…);

Thanks for help.