Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Cemal Bayramoglu
Warren, See MarkupContainer#visitChildren Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 15 April 2010 18:44, Warren Bell warr...@clarksnutrition.com wrote: Is there a way to add attributes to child components in a behavior that

Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Warren Bell
I have that figured out, I just don't know how to add the attribute to each component. I can't add a behavior, since Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Can I even do this in a behavior? Cemal Bayramoglu wrote: Warren, See

RE: Adding attributes to child components in a behavior.

2010-04-15 Thread Warren Bell
Sorry if this got double posted, I didn't see it up there. I have that figured out, I just don't know how to add the attribute to each component. I can't add a behavior, since Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Can I even do

Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Michael O'Cleirigh
Hi Warren, The way I normally handle this situation is to create a javascript emitting behaviour that is attached to the container. This behaviour will emit the necessary javascript method to do what you need to do. Then for each child component you can use an AttributeModifier to write

Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Cemal Bayramoglu
I assume you were trying this in beforeRender of your behaviour, which as you say is too late. If you really need to use a behaviour encapsulate all this, try something like the following, but some may feel its a little politically incorrect to do this in bind. class MyBehaviour extends

Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Cemal Bayramoglu
... and if you're not building your component tree before you add such an IBehaviour to the parent container you can instead override onBeforeRender on that container to do something like: @Override public void onBeforeRender() {

Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Warren Bell
I ended up doing it in bind of the behavior and it works fine. I just have to remember to add the behavior to the page after all the other components. Thanks I assume you were trying this in beforeRender of your behaviour, which as you say is too late. If you really need to use a behaviour

Re: Adding attributes to child components in a behavior.

2010-04-15 Thread Jeremy Thomerson
Yes, this is risky. Why not add the appropriate onclick handler via JS on the client side? i.e., you could output javascript (jQuery in this example) that says: $('#myTableID tr').click(function() { // do whatever your onclick should do }); That's just another option - not necessarily the