Select to view content in your preferred language

Dynamic templatePicker based on user-chosen layer

590
2
Jump to solution
08-11-2013 12:26 PM
by Anonymous User
Not applicable
Looking for advice on having multiple layers eligible for editing yet allowing user which to edit a layer based on, say, a pulldown menu. In this case, there are as many as 15 layers which may need editing. However I'd like to populate the templatePicker with only a user-chosen layer.

Thanks in advance,

rGibson
0 Kudos
1 Solution

Accepted Solutions
KellyHutchins
Esri Frequent Contributor
Russell,

You can do this using a combination of TemplatePicker.set and TemplatePicker.update. Here's a link to a fiddle that shows a proof of concept:

http://jsfiddle.net/xM7f4/

View solution in original post

0 Kudos
2 Replies
KellyHutchins
Esri Frequent Contributor
Russell,

You can do this using a combination of TemplatePicker.set and TemplatePicker.update. Here's a link to a fiddle that shows a proof of concept:

http://jsfiddle.net/xM7f4/
0 Kudos
by Anonymous User
Not applicable
Great stuff, Kelly. Thanks!

I actually ended up making it work with something like....(partial code)

function fireEd()
      {          
        map.removeAllLayers();      
        var myLyrList=document.getElementById("myList");
edLayer = myLyrList.options[myList.selectedIndex].text;
map.addLayer(basemap);
     map.addLayers([bldgInteriorFloor1,camerasBasement,doorsBasement,securityBasement,stairsElevBasement]); 
      }

      function initEditor(results) {

      if (templatePicker)
      {
     templatePicker.destroy();
     dojo.create("div", {id: "templateDiv"}, "cPane");
      }
   if (myEditor)
   {
     myEditor.destroy();
           dojo.create("div", {id: "editorDiv"}, "cPane");
   }        

      for (var i=0;results;i++)
      {
     if (results.layer.name == edLayer)
     {
       results = [results];
     }
      }
      var templateLayers = dojo.map(results,function(result){    
            return result.layer;  
        });
0 Kudos