After upgrading to ESRI JSAPI 4.16 from 4.15 - unable to track edits on layer

766
5
Jump to solution
07-23-2020 09:14 AM
divyabathina
New Contributor III
Hi All,
I have upgraded the ArcGIS jsapi 4.15 to 4.16 and the  below has broken. 
I am trying to track edits on the layer . I am using editor widget and click on the Add/update button on editor widget I am trying to find the newly added feature object id as shown below but it the blow code do not work after the upgrade.
editorVM.featureFormViewModel.layer.on("edits",(event: esri.FeatureLayerEditsEvent) => {
if (event.addedFeatures.length > 0) {
console.log( "event.addedFeatures[0].objectId ")
}
trying to find any alternative way to track edits on the layer
 
(catch the event fired after add or update happen when using editor widget)
Thank you,
Divya
0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Contributor

Hi Divya,

Sorry for the delay in getting back to you! Yes, we added it back to the documentation. Unfortunately, we won't be updating the typings for this change - the typings file is so big and it is a lot of work to get updated.

You can instead edit your typings file locally at node_modules/@types/arcgis-js-api/index.d.ts

To add the "edits" event for FeatureLayer:

On line 284, add 

export type FeatureLayerEditsEventHandler = (event: FeatureLayerEditsEvent) => void;

This should go after FeatureFormViewModelValueChangeEventHandler and before FeatureLayerLayerviewCreateErrorEventHandler.

Next, on line 11042, add
on(name: "edits", eventHandler: FeatureLayerEditsEventHandler): IHandle;
This should go after updateAttachment() and before on(name: "layerview-create" ...)
Let me know if this works for you!
Thanks,
Anne

View solution in original post

5 Replies
AnneFitz
Esri Contributor

Hi Divya,

Sorry for the inconvenience, this was a bug on our side. We are working on getting the "edits" event added back to the documentation and the typings. We are planning on updating the typings next week. I'll let you know once it has been updated.

Thanks!

Anne

divyabathina
New Contributor III

Hi Anne,

Thank you for letting me know.

Will be looking forward the Updates.

Kind Regards,

Divya

divyabathina
New Contributor III

Hi @Anne Fitz Employee,

      I have just noticed.  "edits" event is added back to the documentation. Just wondering if the Typings got updated(As it's still not working for me). If not when can we expect it 

Thank you,

Divya

0 Kudos
AnneFitz
Esri Contributor

Hi Divya,

Sorry for the delay in getting back to you! Yes, we added it back to the documentation. Unfortunately, we won't be updating the typings for this change - the typings file is so big and it is a lot of work to get updated.

You can instead edit your typings file locally at node_modules/@types/arcgis-js-api/index.d.ts

To add the "edits" event for FeatureLayer:

On line 284, add 

export type FeatureLayerEditsEventHandler = (event: FeatureLayerEditsEvent) => void;

This should go after FeatureFormViewModelValueChangeEventHandler and before FeatureLayerLayerviewCreateErrorEventHandler.

Next, on line 11042, add
on(name: "edits", eventHandler: FeatureLayerEditsEventHandler): IHandle;
This should go after updateAttachment() and before on(name: "layerview-create" ...)
Let me know if this works for you!
Thanks,
Anne

View solution in original post

divyabathina
New Contributor III

Hi Anne,

Thank you so much for your support.

 I have added the above details as you mentioned. I have added below line at 11369 after export interface EditingInfo and before export interface FeatureEditResult. 

this has removed all the errors.

export interface FeatureLayerEditsEvent {
addedAttachments: FeatureEditResult[];

addedFeatures: FeatureEditResult[];

deletedAttachments: FeatureEditResult[];

deletedFeatures: FeatureEditResult[];

updatedAttachments: FeatureEditResult[];

updatedFeatures: FeatureEditResult[];
}
 
Thanks ,
Divya