Recent Changes - Search:





Element properties and expressions

Properties of view elements can also be connected to expressions that involve model variables (or not), such as, for instance:

  • x+1, where x is a model variable of type double,
  • Math.sin(0.5), or
  • “Text = “+textString, where textString is a model variable of type String.

EJS will evaluate the expression correctly and assign its result to the view element property.


Bidirectionality is lost, however. This means that, for instance, if you connect a property to the expression x+1 and x changes in the model, the property is still correctly updated. But NOT the other way round. If you interact with the element expecting to change the property, the model variable will not be changed (to the property value minus 1). Most likely the property will be forced back to the value of x+1 after the interaction, resulting in no apparent change of the element.


This behavior is due to the reason that not all expressions have inverse. What should EJS do if you used the expression x*x? The inverse provides two possible values - positive and negative. Which one should EJS use?

Edit - History - Print - Recent Changes - Search
Page last modified on April 29, 2009, at 12:11 AM