Binding readdata early attachment when possible. #30
Labels
enhancement request
Request for a new feature or improvement of an existing one
TO DO Task
Well-defined Task
The problem
Unlike the
writedata
the readdata setting in bindings is more difficult to process. It consists of a list of event specifications to which the binding must attach and update its target when any of the specified occurs. The events can be specified in two ways:event name e.g. click, $activatedevent
parent/child element address and event on it e.g. panel1/repeater1:$itemschangedevent or panel1/button1:click
The second syntax specifies the exact location and event to attach to without need of further calculations, but the first doesn't. It means attach to this event on the object from which source data is read. So, the object on which the event should be used is determined by two things together: the
source
orservice
setting and thepath
setting. This makes its calculation the same as the calculation need to really read the source and for this reason currentlyreaddata
events are attached during the first read from the source. This effectively means that this is occurring typically on the first updateTargets. In the overwhelming majority of cases this will be good enough, but if areaddata
event points to an earlier sibling and event occurrence may be skipped, because the registration with that event will be late.Solution
Obviously advising the late registrants for the last event occurrence (if any) is only a partial and even bad solution, not even possible for DOM events and forcing this behavior on classes that have no actual reason to enable it.
So, the solution I have in mind is a bit more complicated:
Attach all events with parent/child keys early, just like in the
writedata
case (completely doable)If the binding has a single part path the source object is completely determined by the
source
setting and this makes finding it as simple as in the other case (with parent/child keys). So, analyse this and attach all events if this is the case.What remains is done like before (on first source read) with (possibly) an option to force early source calculation. The option can be used by the developer if he thinks the calculation is indeed possible while creating the bindings - a case we cannot determine safely enough automatically.
The text was updated successfully, but these errors were encountered: