Don't do this with AJAX - that's overkill. Just use a JS library and attach to onfocus.
-- Jeremy Thomerson http://www.wickettraining.com On Tue, Apr 6, 2010 at 1:21 PM, Arnaud Garcia <arn...@imagemed-87.com>wrote: > ok, find, so just do: > item.setOutputMarkupPlaceholderTag(true); > and > > myTextField.add(new AjaxEventBehavior("onfocus") { > > @Override > protected void onEvent(AjaxRequestTarget target) > { > item.add(new SimpleAttributeModifier("class", > "selected")); > target.addComponent(item); > } > }); > > > Arnaud > 2010/4/6 Arnaud Garcia <arn...@imagemed-87.com> > > > Hello, > > > > I have a simple DataView where each row has some labels and textfields. > > Each time the user enter in a textfield I would like to highlight the > > selected row. (The idea is to adapt the wicket stuff example > (OIRPage.java) > > with an AjaxFormComponentUpdatingBehavior("onfocus") instead of a simple > > Link) > > > > > > The example in wicket stuff > > ( > > > http://wicketstuff.org/wicket/repeater/?wicket:bookmarkablePage=:org.apache.wicket.examples.repeater.OIRPage > > ) > > > > shows how to highlight the selected row using ReuseIfModelsEqualStrategy > > when the user click on a Link. > > > > Using the AjaxFormComponentUpdatingBehavior with the "onfocus" event I > try > > to simulate the Link click but it does not work... > > > > myTextField.add(new AjaxFormComponentUpdatingBehavior("onfocus") { > > > > @Override > > protected void onUpdate(AjaxRequestTarget target) { > > HighlitableDataItem<EtudiantAS> hitem = > > (HighlitableDataItem<EtudiantAS>) item; > > hitem.toggleHighlite(); > > // target.addComponent( ??? don' know what to put > > here, how to re-render the item) > > > > } > > }); > > > > > > Well, any idea > > > > thanks > > > > Arnaud > > >