FeatureLayer: update-end equivalent in 4.7

2261
7
Jump to solution
06-04-2018 09:01 PM
MichalGasparovic
New Contributor III

The title says it all, but I'll repeat:

- what is the 'update-end' event (v3.23) equivalent in 4.7? How do I correctly connect the 'draw end' event of the feature layer?

Those who have seen my last few posts, they know I've inquired about the popup and its issues after the refresh, where I was connecting to the 'refresh' event via 'watch'. Well, the thing is that at this very point the features are not refreshed yet as per see as the watcher apparently kicks off before the features are set fot the layer so I'm always getting the old snapshot of the data...

Thank you for all your help. Me as a developer I really miss the level of detail the previous version has offered (v3.x). The new one (v4.+) is good, but lot of information feels like it's hidden....

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor

The layers have a property called updating. This value is true when the layer is fetching data. When it's done, the value is the false.

You can watch for this property change a few ways, but we provide a utility module that offers a lot of options.

watchUtils | API Reference | ArcGIS API for JavaScript 4.7 

Here is a sample of you can watch for the updating property.

LayerView - Updating 

View solution in original post

7 Replies
ReneRubalcava
Frequent Contributor

The layers have a property called updating. This value is true when the layer is fetching data. When it's done, the value is the false.

You can watch for this property change a few ways, but we provide a utility module that offers a lot of options.

watchUtils | API Reference | ArcGIS API for JavaScript 4.7 

Here is a sample of you can watch for the updating property.

LayerView - Updating 

MichalGasparovic
New Contributor III

But still, the doco is just not enough. I don't care about watchUtils page, I want to be able to read all about the FeatureLayer on draw end and how to connect to it on its own page. There is a SINGLE instance of word 'watch' on the whole page at the time of writing this and nothing regarding on how to connect to the event once the layer is drawn. See yourself.
FeatureLayer | API Reference | ArcGIS API for JavaScript 4.7 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Michal,

   The documentation does not mention watch except in one code snippet because the whole FeatureLayer class inherits from Accessor as most of the classing in the 4. API do. So the Accessor class is what gives you the ability to watch all properties. There is no need to have redundant information about watch on the FeatureLayer page since it inherits all the capabilities from Accessor class.

ReneRubalcava
Frequent Contributor

There are very little events in the 4x API. Most of the API is based around watching for property changes. In this case the property you are interested in is whether or not the layer is done updating. This saves from having to have an update-start and update-end event. It's either true or false. Much more explicit.

0 Kudos
MichalGasparovic
New Contributor III

Agree to disagree. The doco should state it clearly enough even without me having to know about accessor. It's only guessing which property to watch to accomplish the task. Hence I'd call for at least some section in the API doco to state (the obvious to you) which 'events' map to which property change. 
Maybe it's just me as I've taken some time off from the JS API development (2-3years) and coming back I see it's different, but I imagine I wouldn't be the only one to have all the relevant info listed on the class page, or at least linked to the other one.

Again, I like API, doco has been generally pretty good (great in 3.x, less so in 4.x), samples are amazing. Cheers

0 Kudos
UndralBatsukh
Esri Regular Contributor

Rene already answered the question. However, you may find this functionality matrix helpful when comparing 3.x and 4.x. 

Functionality matrix | ArcGIS API for JavaScript 4.7 

0 Kudos
KenBuja
MVP Esteemed Contributor

Undral, are you pointing to an internal Esri site? Should that be instead Functionality matrix | ArcGIS API for JavaScript 4.7