Hi,
I'm switching my layers over to hosted feature layers on our portal. I have a javascript map that consumes the data and presents the layer differently based on what user's select.
The way I'm currently doing it is changing the definitionExpression on the layer based on selection.
Now when I'm adding a layer from portalItem
var streetPavingHostedLayer = Layer.fromPortalItem({
portalItem: {
// autocasts as new PortalItem()
id: "xxxxxxxxxxxxxxxxxx",
portal: {
}
}
});
The above adds the whole layer. But the below doesn't filter correctly. I can't make heads or tails when I inspect the errors. Doesn't point to my code.
Can I add a definition expression, like definitionExpression: "roadname = 'CHABOT CT'"? I can't get it to work. Wondering if it doesn't work or I'm just formatting the expression wrong.
If I can't do this, wondering if my best bet is to make a different view for each way I want to portray the layer and then just call the layer desired when selected by user?
Thanks for any thoughts.
-Tim