Tuesday, December 18, 2012

Add an isDirty attribute to your entity

Here is a useful Groovy expression that can be used to add a transient attribute to your Entity that will return true if any attribute in your entity is new or has been modified

 (entityState != 1)

See Image below

Then add this attribute to your view object and use it in an expression to highlight rows that have been modified and not yet commited,.

 inlineStyle="#{row.isDirty ? 'background-color:#FFF9B3;' : ''}"

 Here's another Groovy expression that will display the original posted value of any attribute in your entity that has been modified but not yet posted


For an overview of using Groovy expression in ADF see this white paper by Grant Ronald


  1. This is a clean way to get the isdirty() without code, but only works if you change rows. I found that if you set autosubmit to true and set the partial page triggers for the changed field to the attribute ID it updates automatically.

  2. Also note that inline style applies to output text fields, while the contentStyle applies to input text fields.