I'd like to get the count of features, without making another call the the server, after the definition expression of a feature layer is changed. I'm using JSAPI 4.2
Solved! Go to Solution.
After reading through the docs more finally came up with a solution:
I'm using the angular-esri libraries, but the idea is the same. Call that after the definitionExpression is set. I don't think you can even get a count from the featurelayer, had to get it from the featurelayerview. I just had to save that extra call to the server.. Thanks!
Daniel,
There is not. But a work around is to attach a listen for the update-end right before you use setDefinitionExpression and then remove the update-end event listener inside the handler function.
var updateEndHandlerEvt = featureLayer.on('update-end', updateEndHandler);
featureLayer.setDefinitionExpression("blah blah");
function updateEndHandler(){
updateEndHandlerEvt.remove();
//now do something since the definition expression is applied
}
Sorry, I should have been more clear in my main post. I'm on 4.2, I only put the version in the hashtag section. I'll update the main question.
I don't see that even in 4.2, I do see a "layerview-create" on the FeatureLayer, but I already tried that and it didn't hit it.
Any other ideas? Thanks!
DJ
After reading through the docs more finally came up with a solution:
I'm using the angular-esri libraries, but the idea is the same. Call that after the definitionExpression is set. I don't think you can even get a count from the featurelayer, had to get it from the featurelayerview. I just had to save that extra call to the server.. Thanks!
I have this exact issue, but it doesn't seem that the event handler for "on-set-definition-expression-complete" has been added. Any other ideas for a simple implementation? It seems the definition expression will break out the query into batches. I need to know when they are all done resolving.