PDA

View Full Version : Please reconsider Binding strategy



Kutu
4 Jun 2008, 8:17 AM
Currently, Ext-GWT uses the concept of "Viewer" to apply Model<->Widget binding. While Viewer seems flexible such that it only deals with how to view Model and sorting and so on so forth, I do feel that this is getting out-of-control.

How can one add/remove/delete a model from a List of models (say in the case of TreeTable, Tree, Table, List etc)?

In the example, if I'm not mistaken, one can remove from the Viewer. But if that is the case, then removing from the List of models (or from the model itself) is considered:

Dangerous?
Won't affect the UI?
Another way to remove a model?
Coupling Viewer with Widget and ModelPlease consider creating a separate "bindable" widget and provide one way to modify the binded model to the Widget.

The "Viewer" is starting to confuse, polute and add more object/class to the overall UI code.

darrellmeyer
4 Jun 2008, 7:38 PM
I think you are looking at this the wrong way. Model changes can be propogated to the widget in 2 ways. One, you make changes via the Store (not the binder). When a widget is bound, add, remove, updates via the Store get reflected in any "bound" widget. Two, the Store can can listen for model change events directly by setting store.setMonitorChanges(true). Changes to the model should not be made via the binder.

With the current code, update and remove have been removed from the binder as this should be done via the store.