Correct deletion of an element from an array in the props of a perspective component

Hello,

Currently to modify the properties of my component I use this :
this.props.store.props.write("configuration", context.configuration);

However, I noticed that when I delete an element from my array, it is correctly deleted but not its bindings.
This means that when the first element is deleted, the second takes its place and thus recovers its bindings.

What is the correct method to completely remove a props and its bindings?

Why do you have bindings on elements you plan to delete?
Dont do this.
Also you probably shouldnt delete through the component like that atall, but instead send an event or use extension functions to call the gateway.
See the component as frontend, and use the events/delegate/extension functions as backend to call the gateway.
This will allow the developers who use your component to handle the logic to delete things

1 Like

In my module, I integrate a web component from a library.
I made sure that the user can graphically modify the configuration of this component. (only from the designer)

Indeed it's a better idea, I'll try to use events/delegate/extension to handle all this in the backend and expose the methods.
I'll do some tests and come back to you to close this topic.

delegates + extension functions allows you to “wait” for a reply from the backend to then do some other logic in the frontend. It is rather complex to set up, but extremely flexible to mix a bith of frontend logic with backend.

(see the extension function in alarms table component, where its used as some sort of filter)

event you probably already know plenty about^^ And i recommend this option first as its a lot easier to work with.

I just started working on this again.

I can correctly read/write to my component’s props from my Delegate using the PropertyTree class.
However, it is impossible to interact with the bindings, which are stored at the Component level and not at the props level.

Does anyone have an idea ? My goal is to remove a binding.

like i said this is terrible practice and should not be done, if its even possible at all

2 Likes

Concur. Bindings are tools for the designer to use. A component's own requirements should be satisfied entirely within the component.

1 Like

Yes, I understand, but this is only for using the designer in preview mode. (F5)
Anyway, I’ve done a lot of research and I don’t think it’s possible.
So I’m going to give up my idea for deleting elements but leave it for creating.

Thanks a lot for your help !

If you need a special case for preview mode, you are probably doing something else wrong. ):