У меня есть два редактируемых слоя объектов в моем приложении, и я пытаюсь подключить соответствующий инспектор атрибутов в зависимости от того, какой слой уровня, который пытается изменить мой пользователь.Используя тот же InfoWindow для двух AttributeInspectors
Я создаю инспекторов атрибутов для обоих слоев объектов, когда загружается мое приложение, а затем прикрепляет соответствующий инспектор атрибутов к InfoWindow карты, когда пользователь пытается отредактировать функциональный слой.
Все работает хорошо, пока пользователь не попытается отредактировать другой функциональный уровень. Когда я пытаюсь подключить другого инспектора атрибутов к инфоузлу, он просто заканчивается.
Вот примерно то, что я делаю:
// AttributeEditor1 for FeatureLayer1 in Class1
constructor: function(options) {
this.options = lang.mixin(this.options, options);
this.map = options.map;
this.configureAttributeEditor1();
},
configureAttributeEditor1: function() {
this.attributeEditor1 = new AttributeInspector({
layerInfos: layerInfos
}, domConstruct.create("div"));
// here I add a Save and Delete button and various event handlers
this.attributeEditor1.startup();
},
// I call this when I know that the user wants to edit FeatureLayer 1
attachEditor1: function() {
this.map.infoWindow.setContent(this.attributeEditor1.domNode);
this.map.infoWindow.resize(350, 240);
},
// AttributeEditor2 for FeatureLayer2 in Class2
constructor: function(options) {
this.options = lang.mixin(this.options, options);
this.map = options.map;
this.configureAttributeEditor2();
},
configureAttributeEditor2: function() {
this.attributeEditor2 = new AttributeInspector({
layerInfos: layerInfos
}, domConstruct.create("div"));
// here I add a Save and Delete button and various event handlers
this.attributeEditor2.startup();
},
// I call this when I know that the user wants to edit FeatureLayer 2
attachEditor2: function() {
this.map.infoWindow.setContent(this.attributeEditor2.domNode);
this.map.infoWindow.resize(350, 240);
},
Спасибо заранее.
Вы имеете в виду AttributeEditor1 works, а AttributeEditor2 - нет? –
AttributeEditor1 работает, пока я не поменяю содержимое InfoWindow карты на AttributeEditor2. Когда я затем попытаюсь добавить AttributeEditor1 снова в InfoWindow, он будет пустым. – awm