steven_3535

Showing multiple definition expressions at once

Discussion created by steven_3535 on Jun 30, 2014
Latest reply on Jul 14, 2014 by Georgie.Cassar
Is this even possible since it refreshes each time a definition expression is requested.  I am setting up check boxes for different definition expressions but when one checkbox is clicked it clears the results of another and adds the new definition expression.  Here is some of my code.

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

  layer0.setVisibility(false);

  var checkBox0 = new CheckBox({
        name: "checkBox0",
        value: "agreed0",
        checked: false,
        onChange: function(b0){
    if (b0 == true) {
     layer0.setDefinitionExpression("PurposeCode = '13' AND PaidOffDate IS NOT NULL");
     layer0.setVisibility(true);
    } else {
     layer0.setVisibility(false);
    } }
  }, "checkBox0").startup();  
  
  var checkBox1 = new CheckBox({
        name: "checkBox1",
        value: "agreed1",
        checked: false,
        onChange: function(b1){
    if (b1 == true) {
     layer0.setDefinitionExpression("PurposeCode = '13' AND PaidOffDate IS NULL");
     layer0.setVisibility(true);
    } else {
     layer0.setVisibility(false);
    } }
  }, "checkBox1").startup();
  
  map.addLayers([layer0]);

Outcomes