View Full Version : function to create new window called multiple times problem

22 Oct 2014, 10:22 AM
There is a function that create a new window. However, when a second window is created, it takes the content of the first window instead of generating its own new content (items), and the first window get empty.

If I close the first window before calling the function again, a new window and content are correctly created. How can I preserve the content of previously created window each time a new window is created?

function createWindow(feat_id, pos_x, pos_y, bounds, value){

var map = new OpenLayers.Map('map',
{ projection: new OpenLayers.Projection("EPSG:3857"),
numZoomLevels: 20,

map.size = new OpenLayers.Size(250,250);
var bounds = new OpenLayers.Bounds.fromArray(bounds);

// this panel is the content
var geoExtPanel = Ext.create('GeoExt.panel.Map', {
id: 'geoExtPanel',
map: map,
border: 0,

var mapWin = Ext.create('Ext.window.Window', {
title: "Layer: {{ layer.filename }} | Feature: " + value,
id: feat_id,
x: pos_x,
y: pos_y,
height: 250,
width: 250,
layout: 'fit',
items: [
collapsible: true,
autoDestroy: false,
bodyBorder: false,
shadowOffset: 6,
renderTo: Ext.getBody(),

22 Oct 2014, 2:29 PM
Try removing the hard 'id' configs and see if that helps.