Persistent Dynamic Properties on Component

Hi All,

I have a component that will generate it’s own dynamic properties and I have the intention that users would then bind them to other tags/components to give my component some input. Whenever I set up a page from scratch, everything is fine but whenever I re-load a screen, my component is still creating those dynamic properties and the client/designer throws a bunch of errors. Is there a way to persist dynamic properties on a component?

Any dynamic properties you have on a component when the project is saved in the designer will be restored after component creation during window deserialization. If you must dynamically create properties, you should defer it to component startup (I think), and only create the ones that are missing.


Does that mean I’ll need to override the get/setDynamicProps routines to make that object mutable? Or will the following work?

TreeMap<> dynamicProps = getDynamicProps();
// add/remove missing members...

I don’t think you should be using setDynamicProps(). Like, ever. Just add stuff to the TreeMap from getDynamicProps(), after checking that you aren’t stomping on same-named properties already there.

1 Like