Data Binding Model

Related namespace: TSUI.Data

For an article explaining Data Binding and how it will be implemented in TSUI, please see TypeScript UI : Data Binding

Some specific implementation points should noted (especially if developing a server back-end for data binding):
  • The result data of a push request is expected to be the same as if a pull request had been made.
    • This is so that the source can accept/modify/reject the push request and the client has immediate data as to the actual state of the data it is bound to. The expectation is that the source has the most accurate data.
  • The data binding constructor calls the Bind method which attaches to accessor events and replaces the property method. Before changing the property method or trying to remove the binding Unbind should be called.
  • The property to bind to should actually be a method with one, optional parameter (the value to set to) and should return the value of the property.
    • The reason for this is the data binding replaces the actual method with a wrapper function. This wrapper is then called as though it were the actual method. The wrapper calls the actual method to set the property and can then seamlessly update the source with the new value.
    • e.g.
MyProperty(value?: string): string 
        this._myProperty = value; 
    return this._myProperty; 

TSUI - Data Binding Model.png

Last edited Sep 3, 2013 at 6:35 PM by EdwardNutting, version 5


No comments yet.