One of the reasons databinding is so powerful is that bindings are "hot".

To demonstrate this, try typing some text in the first textbox above and then hit Enter. As soon as you press return, both the "you typed" text and the other text box update to show the new value. If you enter text in the other textbox, text updates live, as you type.

This happens without any code - no event handlers, no special Javascript.

Binding is two-way . When the text property in the TextBox called "c1" changes, the framework checks to see if any other controls have properties bound to c1's text property. It finds the Label and the second TextBox, so it propagates changes to the bound properties in those controls.

Similarly, if you edit the "Another TextBox"'s text, Jitsu notices that the text is bound, it finds the source of the binding, and propagates the change to the source, and from there to the other Label on the page.

Bind Anything

This page demonstrates that data binding works not just to connect a list to some data. In Jitsu, with few exceptions, bindings are extremely general. You can bind any control to any other control, and any control to any data object. You can even make new instances of JavaScript objects and add bindings to them.

Ids and Controls

In the control hierarchy, use controlId to give controls names. e.g.

<Button controlId="xxx"/>.

Unlike HTML ids, which are global to a page, control ids are "scoped" to the control's nearest parent binding container . Other controls in the same binding container can refer to the control using #bind(controls.name).

See Relative Binding for more on binding containers.

Ids and Data

In the data tree, on the other hand, you give data objects names using the Xml id attribute (Jitsu can't use "id" for control names because it clashes with HTML). For example:

<Person id="fred" firstName="Fred">.

Data object id names are scoped to the direct DataSet or DataList parent of the data object. So if "fred" is in a data set called people, you can refer to fred using #bind(data.people.fred).