Project WONDER-Frameworks-Ajax-AjaxHighlight

Last modified by Pascal Robert on 2010/09/12 03:19

AjaxHighlight provides a convenient way to queue up an object as highlighted so that it gets a highlight effect when the next page renders.

In the action prior to returning the page that will show a highlight, you can call Computer code|AjaxHighlight.highlight(theObject). The object you highlight could be a String, an EO, or whatever object makes sense in your context.

Then you simply bind

value = ..

on this component on the following page. If the value matches an object that was flagged as highlighted, the container you specify will receive the highlight effect. This component can also generate its own container if you do not specify another container id.

So you can do:


private Person _person;
...
public WOActionResults savePerson() {
_person.editingContext().saveChanges();
AjaxHighlight.highlight(_person);
return pageWithName(PersonListPage.class);
}

and in PersonListPage:


<ul>
<wo:WORepetition list = "$people" item = "$repetitionPerson">
<wo:AjaxHighlight elementName = "li" value = "$repetitionPerson"><wo:str value = "$repetitionPerson.name"/></wo:AjaxHighlight>
</wo:WORepetition>
</ul>

When the page loads, the newly created person will get the scriptaculous Computer code|Effect.Highlight yellow flash effect (you can also specify

effect = "SomeOtherScriptaculousEffect"

if you don't like Computer code|Effect.Highlight).