WebObjects/Project WONDER/Frameworks/Ajax/AjaxHighlight

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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 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() {
	return pageWithName(PersonListPage.class);

and in PersonListPage:

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

When the page loads, the newly created person will get the scriptaculous Effect.Highlight yellow flash effect (you can also specify effect = "SomeOtherScriptaculousEffect" if you don't like Effect.Highlight).