This question was covered in the thread above, of course, the thread is very long and full of incorrect approaches, so it's easy to miss:
In other words, say you have a form you want to populate with a Record from a ListGrid. Make your own variant of editRecord() that calls the original editRecord() but also populates the CanvasItem via setValue(). Use the same pattern when saving. Re-use this by using your own custom subclass of DynamicForm pervasively, which is a standard approach for extending the databinding system.
We plan to add APIs to CanvasItem to make it possible to just plug into an ordinary DynamicForm without using a subclass (already possible in SmartClient), as well as create samples for this. However this will not be based on overriding setValue(), because there are ~10 type-specific variants of that method.
We will not be using the "final" qualifier because in most Java libraries this is used to indicate that a method is *designed* to never be overridden. In SmartGWT it's just not yet a valid override point and may be in the future.
If you want to encapsulate that, you can make a subclass of DynamicForm that is aware of your special CanvasItem that isn't capable of change notifications, and retrieves its value right before save and validation. Or, encapsulate it at a higher level, such as a combined grid and form component like that shown in the Pattern Reuse sample.
We plan to add APIs to CanvasItem to make it possible to just plug into an ordinary DynamicForm without using a subclass (already possible in SmartClient), as well as create samples for this. However this will not be based on overriding setValue(), because there are ~10 type-specific variants of that method.
We will not be using the "final" qualifier because in most Java libraries this is used to indicate that a method is *designed* to never be overridden. In SmartGWT it's just not yet a valid override point and may be in the future.
Comment