AnsweredAssumed Answered

add layerlist to titlepane in javascript 4.6 api

Question asked by pvitt on Apr 3, 2018
Latest reply on May 4, 2018 by pvitt

Hi - I'm making an application using the view ui to place user interface items on the screen.  I've got a layerlist control that takes up a lot of space so I'd like to put it inside a title pane so the control can be open and closed.  I've successfully created the titlepane and added it to the view.ui, but I'm having trouble getting the layer list to appear inside the titlepane.  My code is as follows:

 

view.then(function () {

//add feature service
map.add(flGWMZ); //feature service gets added to the map

 

//create the title pane -- this gets created successfully
var tp = new TitlePane({ title: "Layers"});
dom.byId("mapDiv").appendChild(tp.domNode);
tp.startup();

 

//create the layer list and add to the title pane -- something going wrong here
var layerList = new LayerList({
view: view
}, "tp"
);

 

//add the titlepane to the lower left -- an empty title pane gets added to the map
view.ui.add(tp, "bottom-left");

 

if I dont use the tile pane and just add the layerlist directly to the layerlist gets generated fine

 

//create the layer list and add to the title pane
var layerList = new LayerList({
view: view});

 

// Add widget to the lower left corner of the view
view.ui.add(layerList, "bottom-left");

 

Any ideas where I'm going wrong?

 

Thanks

 

Pete

Outcomes