Editor widget 4.22 force value attribute on creation

446
3
Jump to solution
05-26-2022 02:23 PM
DamianoMontrasio
New Contributor III

Between version 4.16 and version 4.22 of the API, on the FeatureLayer's "edits" event, the "target" property (hence target.url) is no longer exposed/returned, which we use to perform a check, i.e., figuring out on which layer to go and update the an other field with the WebService 'Update_Features'.

Any images of code...

DamianoMontrasio_0-1653601007853.png

and

DamianoMontrasio_1-1653601024934.png

 

there's an other way to create a feature with an hidden field forced to a specific value?

thanks 

0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

You can use bind in order to maintain a reference to your layer. For example:

l_FeatureLayer.on("edits", otRilievi_Object.rilievi_edits_complete.bind(otRilievi_Object, l_FeatureLayer));

...and elsewhere...

this.rilievi_edits_complete = function(target, p_Features) {
	//target is now a reference to the layer being edited
};

View solution in original post

0 Kudos
3 Replies
DamianoMontrasio
New Contributor III

This is a compate beteen api 4.15 with target property and 4.22 without.

DamianoMontrasio_0-1653602826121.png

I've not found info about deprecation of target....

Was useful for us.

Thanks

0 Kudos
JoelBennett
MVP Regular Contributor

You can use bind in order to maintain a reference to your layer. For example:

l_FeatureLayer.on("edits", otRilievi_Object.rilievi_edits_complete.bind(otRilievi_Object, l_FeatureLayer));

...and elsewhere...

this.rilievi_edits_complete = function(target, p_Features) {
	//target is now a reference to the layer being edited
};
0 Kudos
DamianoMontrasio
New Contributor III

Thank you very much Joel,

your suggestion was perfect!!!

0 Kudos