We work with a combination of dojo Vers 1.10 and ArgGis Javascript APi 3.11.
We were asked if it ist possible to copy the TOC Layerlist into a seperate dojo FloatingPaneby rightclicking into the map. No Problem so far. Now i should insert two Buttons which should
a. disable all active Layersand
b. open and close all Parentlayers with activ sublayers.This works as expected.The problem occurs, when I rightclick on the map and copy the content of the TitlePaneLayerlist into the FloatingPane. The Buttons where copied, looks like Buttons but it seems that they weren't Buttons anymore.
Here's the code that copied the content :
registry.byId("LayerListTP").set("content",registry.byId("LayerTitlePane").get("content")); registry.byId("LayerTitlePane").destroyDescendants();LayerListTP is the new FloatingPane, LayerTitlePane the Original location of the Layerlist.Because there can't be double Id's i destroy the content of the LayerTitlePane afterwards.
Copying the content back to the original Titlepane works identical, the Buttons are messed up.
I can't figure out where the Problem with the Buttons come from ane why they weren't copied right.
Here are all necessary Codesnippets.
Function to copy LayerList
function createContextMenuLayer(){ require([ "dijit/Menu", "dijit/MenuItem", "dijit/registry", "dojox/layout/FloatingPane", "dojo/_base/window", "dojo/_base/array", "dojo/dom", "dojo/dom-attr", "dojo/dom-construct", "dojo/dom-style", "dojo/on", "dojo/query", "dojo/sniff", "esri/map", "esri/geometry/Point" ], function( Menu, MenuItem, registry, FloatingPane, win, array, dom, domAttr, domConstruct, domStyle, on, query, sniff, Map, Point ) { var ctxMenuForGraphics, ctxMenuForMap; var currentLocation; var ShowLayerList; var LayerNotActive=[]; var RememberLayerNotActiv=[]; on(map,"MouseUp",function(evt){ if(evt.which === 3){ var LayerListContent = '
'; if(!registry.byId("LayerListFloatingPaneId")){ LayerListFloatingPane = new FloatingPane({ id:"LayerListFloatingPaneId", closeable:true, dockable:false, title:"Karteninhalt", content:LayerListContent, style:"width:250px;height:250px;position:absolute;top:0px;left:0px;" },domConstruct.create('div', null, map.container)); SaveLayerTP = []; LayerNotActive=[]; var inputs = query(".dijitCheckBoxGrouplayer"), input; var inputs2 = query(".dijitCheckBoxNonGrouplayer"), input2; var GroupedAndNonGroupedLayers = inputs.concat(inputs2); for (var i=0, il=GroupedAndNonGroupedLayers.length; i nav.clientHeight || nav.scrollHeight > nav.clientHeight && registry.byId("LegendTitlePane").open == true){ domStyle.set(dom.byId("sliderTocIn"),setIconToRight); } else{ domStyle.set(dom.byId("sliderTocIn"),setIconBack); } } },180); }); LayerListFloatingPane.startup(); LayerListFloatingPane.show(); //Laden der aktivierten Layer if(SaveLayerTP.length != 0){ array.forEach(SaveLayerTP,function(LayerNr){ domAttr.set(dom.byId(LayerNr),"checked",true); }); Layersvisible = SaveLayerTP; } if(LayerNotActive != 0){ array.forEach(LayerNotActive,function(LayerNr){ domAttr.set(dom.byId(LayerNr),"checked",false); }); } dynamicMapServiceLayer.setVisibleLayers(Layersvisible); //Was passieren soll wenn der FloatingPane geschlossen wird LayerListFloatingPane.close = function (){ //eingeblendete Layer speichern RememberLayerklicked = []; RememberLayerNotActiv = []; var inputs3 = query(".dijitCheckBoxGrouplayer"), input; var inputs4 = query(".dijitCheckBoxNonGrouplayer"), input2; var GroupedAndNonGroupedLayers2 = inputs3.concat(inputs4); for (var i=0, il=GroupedAndNonGroupedLayers2.length; i nav.clientHeight || nav.scrollHeight > nav.clientHeight && registry.byId("LegendTitlePane").open == true){ domStyle.set(dom.byId("sliderTocIn"),setIconToRight); } else{ domStyle.set(dom.byId("sliderTocIn"),setIconBack); } } //Inhalt des FloatingPanes zerst
أكثر...
We were asked if it ist possible to copy the TOC Layerlist into a seperate dojo FloatingPaneby rightclicking into the map. No Problem so far. Now i should insert two Buttons which should
a. disable all active Layersand
b. open and close all Parentlayers with activ sublayers.This works as expected.The problem occurs, when I rightclick on the map and copy the content of the TitlePaneLayerlist into the FloatingPane. The Buttons where copied, looks like Buttons but it seems that they weren't Buttons anymore.
Here's the code that copied the content :
registry.byId("LayerListTP").set("content",registry.byId("LayerTitlePane").get("content")); registry.byId("LayerTitlePane").destroyDescendants();LayerListTP is the new FloatingPane, LayerTitlePane the Original location of the Layerlist.Because there can't be double Id's i destroy the content of the LayerTitlePane afterwards.
Copying the content back to the original Titlepane works identical, the Buttons are messed up.
I can't figure out where the Problem with the Buttons come from ane why they weren't copied right.
Here are all necessary Codesnippets.
Function to copy LayerList
function createContextMenuLayer(){ require([ "dijit/Menu", "dijit/MenuItem", "dijit/registry", "dojox/layout/FloatingPane", "dojo/_base/window", "dojo/_base/array", "dojo/dom", "dojo/dom-attr", "dojo/dom-construct", "dojo/dom-style", "dojo/on", "dojo/query", "dojo/sniff", "esri/map", "esri/geometry/Point" ], function( Menu, MenuItem, registry, FloatingPane, win, array, dom, domAttr, domConstruct, domStyle, on, query, sniff, Map, Point ) { var ctxMenuForGraphics, ctxMenuForMap; var currentLocation; var ShowLayerList; var LayerNotActive=[]; var RememberLayerNotActiv=[]; on(map,"MouseUp",function(evt){ if(evt.which === 3){ var LayerListContent = '
'; if(!registry.byId("LayerListFloatingPaneId")){ LayerListFloatingPane = new FloatingPane({ id:"LayerListFloatingPaneId", closeable:true, dockable:false, title:"Karteninhalt", content:LayerListContent, style:"width:250px;height:250px;position:absolute;top:0px;left:0px;" },domConstruct.create('div', null, map.container)); SaveLayerTP = []; LayerNotActive=[]; var inputs = query(".dijitCheckBoxGrouplayer"), input; var inputs2 = query(".dijitCheckBoxNonGrouplayer"), input2; var GroupedAndNonGroupedLayers = inputs.concat(inputs2); for (var i=0, il=GroupedAndNonGroupedLayers.length; i nav.clientHeight || nav.scrollHeight > nav.clientHeight && registry.byId("LegendTitlePane").open == true){ domStyle.set(dom.byId("sliderTocIn"),setIconToRight); } else{ domStyle.set(dom.byId("sliderTocIn"),setIconBack); } } },180); }); LayerListFloatingPane.startup(); LayerListFloatingPane.show(); //Laden der aktivierten Layer if(SaveLayerTP.length != 0){ array.forEach(SaveLayerTP,function(LayerNr){ domAttr.set(dom.byId(LayerNr),"checked",true); }); Layersvisible = SaveLayerTP; } if(LayerNotActive != 0){ array.forEach(LayerNotActive,function(LayerNr){ domAttr.set(dom.byId(LayerNr),"checked",false); }); } dynamicMapServiceLayer.setVisibleLayers(Layersvisible); //Was passieren soll wenn der FloatingPane geschlossen wird LayerListFloatingPane.close = function (){ //eingeblendete Layer speichern RememberLayerklicked = []; RememberLayerNotActiv = []; var inputs3 = query(".dijitCheckBoxGrouplayer"), input; var inputs4 = query(".dijitCheckBoxNonGrouplayer"), input2; var GroupedAndNonGroupedLayers2 = inputs3.concat(inputs4); for (var i=0, il=GroupedAndNonGroupedLayers2.length; i nav.clientHeight || nav.scrollHeight > nav.clientHeight && registry.byId("LegendTitlePane").open == true){ domStyle.set(dom.byId("sliderTocIn"),setIconToRight); } else{ domStyle.set(dom.byId("sliderTocIn"),setIconBack); } } //Inhalt des FloatingPanes zerst
أكثر...