Re: Modify Attribute on DataView HTML Element
I also got it to work by using a wicket:container and a WebMarkupContainer HTML wicket:container wicket:id=dataview div wicket:id=wmc id=dynamic span wicket:id=myLabel / /div /wicket:container JAVA new DataViewPOJO(dataview, dataProvider) { protected void populateItem(ItemPOJO item) { WebMarkupContainer wmc = new WebMarkupContainer(wmc) { protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(id, dynamicValue); } }; item.add(wmc); wmc.add(new Label(myLabel, item.getModelObject().getValue())); } } Is one way better than the other? On Thu, Dec 16, 2010 at 6:51 PM, Martijn Dashorst martijn.dasho...@gmail.com wrote: item.add(new AttributeModifier(attr, true, value)); dataview#oncomponenttag doesn't do anything since the dataview repeats its markup with a listitem. the list item#oncomponenttag actually receives the markup tag. Martijn On Thu, Dec 16, 2010 at 10:04 PM, Matt Schmidt mschmid...@gmail.com wrote: I'm trying to modify an attribute on the HTML element that goes with my DataView: HTML div wicket:id=dataview id=dynamic span wicket:id=myLabel / /div JAVA new DataViewPOJO(dataview, dataProvider) { protected void populateItem(ItemPOJO item) { item.add(new Label(myLabel, item.getModelObject().getValue())); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(id, dynamicValue); } } I thought this would do it, but I never even hit DataView.onComponentTag(). Any other suggestions? -Matt -- Become a Wicket expert, learn from the best: http://wicketinaction.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Modify Attribute on DataView HTML Element
Your solution holds some unneccessary code/markup (a whole component) while Martijns approach is straight to the point. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Modify Attribute on DataView HTML Element
I'm trying to modify an attribute on the HTML element that goes with my DataView: HTML div wicket:id=dataview id=dynamic span wicket:id=myLabel / /div JAVA new DataViewPOJO(dataview, dataProvider) { protected void populateItem(ItemPOJO item) { item.add(new Label(myLabel, item.getModelObject().getValue())); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(id, dynamicValue); } } I thought this would do it, but I never even hit DataView.onComponentTag(). Any other suggestions? -Matt
Re: Modify Attribute on DataView HTML Element
item.add(new AttributeModifier(attr, true, value)); dataview#oncomponenttag doesn't do anything since the dataview repeats its markup with a listitem. the list item#oncomponenttag actually receives the markup tag. Martijn On Thu, Dec 16, 2010 at 10:04 PM, Matt Schmidt mschmid...@gmail.com wrote: I'm trying to modify an attribute on the HTML element that goes with my DataView: HTML div wicket:id=dataview id=dynamic span wicket:id=myLabel / /div JAVA new DataViewPOJO(dataview, dataProvider) { protected void populateItem(ItemPOJO item) { item.add(new Label(myLabel, item.getModelObject().getValue())); } protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put(id, dynamicValue); } } I thought this would do it, but I never even hit DataView.onComponentTag(). Any other suggestions? -Matt -- Become a Wicket expert, learn from the best: http://wicketinaction.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org