Showing multiple definition expressions at once

1961
1
06-30-2014 08:20 AM
StevenGraf1
Occasional Contributor III
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]);
0 Kudos
1 Reply
GeorgieCassar
Occasional Contributor

Hi.  I just saw another post about this in this discussion group and it had a solution  https://community.esri.com/message/353365?sr=search&searchId=4465ddbc-aa90-466f-8058-194219238d53&se...