steven_3535

Browser Crashing using too many checkboxes

Discussion created by steven_3535 on Jun 26, 2014
Latest reply on Jun 26, 2014 by steven_3535
Hello, I have 15 feature layers and I am appending a check box to each one so I can turn them on and off.  My services are secured and after I log in my browser takes a while to load and then crashes. Any idea why this is happening?

var layer0 = new FeatureLayer("https://myserver/FeatureServer/0", {
  mode: FeatureLayer.MODE_ONDEMAND,
        infoTemplate: layer0Template,
        outFields:["*"]  
  });

  map.addLayer(layer0);
  layer0.setVisibility(false);

  var checkBox = new CheckBox({
        name: "checkBox0",
        value: "agreed",
        checked: false,
        onChange: function(b){
    if (b == true) {
     layer0.setVisibility(true);
    } else {
     layer0.setVisibility(false);
    } }
  }, "checkBox0").startup();  
  
    
  var layer1 = new FeatureLayer("https://myserver/FeatureServer/1", {
  mode: FeatureLayer.MODE_ONDEMAND,
        infoTemplate: layer0Template,
        outFields:["*"]  
  });

  map.addLayer(layer1);
  layer1.setVisibility(false);
  
  var checkBox1 = new CheckBox({
        name: "checkBox1",
        value: "agreed",
        checked: false,
        onChange: function(b){
    if (b == true) {
     layer1.setVisibility(true);
    } else {
     layer1.setVisibility(false);
    } }
  }, "checkBox1").startup();


In the chrome developer tools it says this a bunch of times:

Error
info: 0
message: "defineAlreadyDefined"
src: "dojoLoader"
stack: (...)
get stack: function () { [native code] }
set stack: function () { [native code] }
__proto__: d

Error
"Error
    at Error (native)
    at Object.f.load (https://js.arcgis.com/3.9/init.js:629:424)
    at https://js.arcgis.com/3.9/init.js:187:69
    at c (https://js.arcgis.com/3.9/init.js:74:221)
    at d (https://js.arcgis.com/3.9/init.js:74:10)
    at resolve.callback (https://js.arcgis.com/3.9/init.js:75:350)
    at c (https://js.arcgis.com/3.9/init.js:74:436)
    at d (https://js.arcgis.com/3.9/init.js:74:10)
    at resolve.callback (https://js.arcgis.com/3.9/init.js:75:350)
    at https://js.arcgis.com/3.9/init.js:191:300"

Outcomes