[Seaside] [Ann] Deltawerken & Storyboard
diego.lont at delware.nl
Fri Sep 28 07:22:30 UTC 2012
On Sep 17, 2012, at 1:01 PM, Diego Lont wrote:
> In another application (commercial, so no code example) we have made a Field that dependent on the value, showed one or more other fields. I will try to add this "ConditionalFieldList" to the framework this week. I have to check if this still works.
It took a bit more time than expected, but finally I got around to adding this Field to Deltawerken with an example. I used Parasol to add some tests, but I guess these should be more extensive.
I have now added a project called "DeltaWeb" to the Deltawerken repository, that demo's the functionality of this field. Some remarks to understand this field a bit better.
In order to have a choice field that "auto" updates itself and generates a list of fields that depends on the state we have modified the following things:
> In order to specify what fields need to be rendered we have an interface that allows us to add a value, with a list of fields that should be rendered when that value is selected. This is the method DEConditionalField addFieldList: aList for: aKey. It takes an array of fields and a key of the select value. Since it is a subclass of a select field, one can also set the labels.
> in DEFieldComponent the actual rendering of the fields takes place. Here we check if a field is a "composite" field. If a field is composite, we render an extra id, so we can render the rows as a whole. Note: this only works for a div view. For a table view one needs to update more (the entire table). This is not implemented.
> The conditional field should create a correct updater when asked for a compositeId. This does not need to be the updater id. It is the id of the div around the composite Fields. This is why it only functions with divs: with a table, I do not have a surrounding element. Also note that when you modify the id, you should also set the updateBlock of the updater.
> Finally there is a problem in the demo with updates of the string / memo field. In deltawerken we use the onChange for updates, and the onChange is fired when you exit this field. It is not fired when you press with your mouse on the radio button (well it is, but after the radio button, and since the field is no longer there). So maybe I need some fix here (I probably should serialize more) ... but I believe this field demonstrates how you can modify the updater to update a bigger part.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside