Hi Jeremy, I'm doing something similar than Araun, but with item.add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { HighLitableDataItem<ThirdModelBasic> hitem = (HighLitableDataItem<ThirdModelBasic>)item; hitem.toggleHighlite();
target.addComponent(item); } }); But, when I click the item, it Highlites a few seconds, then turns back its normal style. Is that because you suggest do not do it with ajax? Is there a way to do this, without rendering all page? When you said "JS library and attach to onfocus.". Do you reference JSLibrarie inside wicketStuff trunk? 2010/4/6 Jeremy Thomerson <jer...@wickettraining.com> > 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 > > > > > > -- | Daniela Valero "No hay vientos favorables para quien no sabe a donde quiere ir!