mercredi 22 octobre 2014

function to create new window called multiple times problem

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?



Code:



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);
map.zoomToExtent(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: [
geoExtPanel
],
collapsible: true,
autoDestroy: false,
bodyBorder: false,
shadowOffset: 6,
renderTo: Ext.getBody(),
}).show();
}





function to create new window called multiple times problem

Aucun commentaire:

Enregistrer un commentaire