DefinitionExpression not working for group layer : WAB Dev Edition 2.24

413
1
Jump to solution
06-07-2022 05:21 PM
PrashantKirpan
Occasional Contributor

Hi All,

I've group layers in my web map, structure looks like below :

PrashantKirpan_0-1654647158687.png

I'm trying to apply definition expression to one of the layer i.e. "Operational PolyFeature" but it's not working. Here is my sample code : 

 

var layerStructureInstance = LayerStructure.getInstance();
 layerStructureInstance.traversal(lang.hitch(this, function (layerNode) {
  if (layerNode.title === 'Operational PolyFeature') {
   layerNode.getLayerObject().then(lang.hitch(this, function (layerObject) {
   layerObject.setDefinitionExpression("objectid = 123");
   layerNode.show();
       }));
      }
   }));

 

How to apply def expression on group layer, any help would be appreciated.

-Prashant

 

0 Kudos
1 Solution

Accepted Solutions
PrashantKirpan
Occasional Contributor

Fixed by using this code 

  layerNode.setFilter(expression);

View solution in original post

0 Kudos
1 Reply
PrashantKirpan
Occasional Contributor

Fixed by using this code 

  layerNode.setFilter(expression);
0 Kudos