Ich habe zwei bearbeitbare Feature-Layer in meiner Anwendung, und ich versuche, den entsprechenden Attributinspektor anzuhängen, je nachdem, welchen Feature-Layer mein Benutzer bearbeiten möchte.Verwenden des gleichen InfoWindow für zwei AttributeInspectors
Ich erstelle die Attribute Inspectors für beide Feature-Layer, wenn meine Anwendung geladen wird, und hänge dann den entsprechenden Attributinspektor an das InfoWindow der Map an, wenn der Benutzer versucht, einen Feature-Layer zu bearbeiten.
Alles funktioniert gut, bis der Benutzer versucht, einen anderen Feature-Layer zu bearbeiten. Wenn ich versuche, einen anderen Attributinspektor an das Infofenster anzuhängen, wird es leer angezeigt.
Hier ist ungefähr das, was ich tue:
// 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);
},
Vielen Dank im Voraus.
Meinst du AttributeEditor1 funktioniert und AttributeEditor2 nicht? –
AttributeEditor1 funktioniert, bis ich den Inhalt des InfoWindow der Karte zu AttributeEditor2 vertausche. Wenn ich dann versuche, AttributeEditor1 erneut dem InfoWindow hinzuzufügen, ist es leer. – awm