noLayers: true - Not working in API 3.8

1114
12
Jump to solution
01-30-2014 08:58 AM
ShaningYu
Frequent Contributor
In TOC, for a layer, I set
  noLayers: true
to simplify the layer's info.  It works well when I used API 2.x.  But in V3.8, this setup losses function.  Could someone hint me how to fix it?  Thanks.
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor
What I think is happening is that it depends on which version of AGSJS TOC that you're using. The sample you're pointing is using ver 1.04. If you look at the source code for the TOC, you'll find noLayer in there.

However, for the current version of TOC, noLayers isn't included. The current example doesn't use it either.

View solution in original post

0 Kudos
12 Replies
JonathanUihlein
Esri Regular Contributor
Sounds like your code is wrong.
0 Kudos
ShaningYu
Frequent Contributor
jon:  Hopefully, you can point out the fault in this piece of code below:
          dojo.connect(map, 'onLayersAddResult', function (results) {
              var sliderTOC = new agsjs.dijit.TOC({
                  map: map,
                  layerInfos: [{
                      layer: operational,
                      title: "LRS Rail",
                      noLayers: true,
                      slider: true
                  }, {
                      layer: operational2,
                      title: "LRS Annotation",
                      noLayers: true
                  }, {
                      layer: basemap,
                      title: "BaseMap",
                      noLayers: true,
                      slider: true
                  }], style: 'inline'
              }, 'sliderDiv');
              sliderTOC.startup();
          });
Thanks.
0 Kudos
JonathanUihlein
Esri Regular Contributor
Hi Shaning.

This is a bit off-topic but needs to be said:

I've personally asked you three times to PLEASE use
 tags when posting code snippets. I've also seen others ask you to do the same, yet you still do not comply. 


I've also noticed you like to credit yourself with answering your own questions, when someone else offers you a legitimate answer.

This is a bit frustrating for both myself and other forum-goers, as it seems you either a) don't understand general forum etiquette or b) you are ignoring our polite requests intentionally. I know option b) is unlikely, as you spend a lot of time on this forum seeking help. However, please be aware that there is a fine line between helping someone, and doing their work for them.

If you would like help, please respect the other users of this forum and follow the rules and guidelines.

Thank you very much.

Back on topic:
Please create a jsfiddle highlighting your problem, with a clear explanation of the issue and errors and I will be able to assist you.
0 Kudos
ShaningYu
Frequent Contributor
Jon:  Hardly understand your response.  Please be professional with proper attitude to anyone's posted thread.  In general, you are a very helpful so that I do respect you a lot.  However, turning some technical issue to something else could hurt people.  Thanks for your response and also some valuable recommendations.
0 Kudos
KenBuja
MVP Esteemed Contributor
Where are you getting noLayers from? That's not one of the properties in the TOCLayerInfo class.
0 Kudos
ShaningYu
Frequent Contributor
kenbuja:  Thanks for your response.  See http://gmaps-utility-gis.googlecode.com/svn-history/r354/trunk/agsjs/docs/toc/examples.html  TOC without Legend:
               var toc = new agsjs.dijit.TOC({
                  map: map,
                  layerInfos: [{
                    layer: operational,
                    title: "Operational Layers",
                    noLegend:true
                  },{
                    layer: basemap,
                    title:'Base Map',
                    noLayers: true
                  }]
                }, 'tocDiv');

and the sample code at http://gmaps-utility-gis.googlecode.com/svn-history/r354/trunk/agsjs/examples/toc.html
I remember that the noLayers property worked as I use API 2.x (e.g. 2.1, 2.4 and 2.7).
0 Kudos
ShaningYu
Frequent Contributor
I just re-tested the code in http://gmaps-utility-gis.googlecode....mples/toc.html, where the API used is 2.4.  If noLayers: true, the sublayers of a layer will not display.  In V3.x, the noLayers property is not there.
In 3.x use      collapsed: true,
collapsed - whether to collapsed the rootLayer layer at beginning. default is false, which means expand if visible, collapse if not.
0 Kudos
KenBuja
MVP Esteemed Contributor
What I think is happening is that it depends on which version of AGSJS TOC that you're using. The sample you're pointing is using ver 1.04. If you look at the source code for the TOC, you'll find noLayer in there.

However, for the current version of TOC, noLayers isn't included. The current example doesn't use it either.
0 Kudos
JeffPace
MVP Alum
Ken is correct, the noLayers property no longer exists.  You should mark his answer as correct.
0 Kudos