Editor widget 4.28

127
3
2 weeks ago
MichaelWen_Timmons
New Contributor III

I'm trying to capture the 'select' event, when users click on an existing feature, from JS API 4.28 editor widget. I can't use the edit event of the underlying layer because I don't want to wait until the user applies the edits. 

So far I could not find the full API library for 4.28. In 4.29 I saw there are events like 'sketch-update' that would be suitable, but that's not available yet in 4.28. 

0 Kudos
3 Replies
KyleONeill
New Contributor II

Do you mean you just want to know when the editor widget is opened to an existing item? If so, you can listen to the state change and then get the values of the item, etc. Not sure if this is what you are trying to do, but sample code below if so.

 

editor.viewModel.watch('state', (state) => {
    if (state === 'editing-attributes') {
        const currentValues =
            editor.viewModel.featureFormViewModel.getValues();
    }
});

 

0 Kudos
MichaelWen_Timmons
New Contributor III

I'm aware of state property but unfortunately it does not meet my needs. I need to know specifically when a polygon or line is being vertex edited so it will be something specific to sketch.  

0 Kudos
KyleONeill
New Contributor II

Ah, I see. I haven't had a need for that so I can't help unfortunately. Good luck!

0 Kudos