I've just run across a problem and I'm stumped, so I really hope someone can 
shed some light on this for me.

I have a page with a paged list component on it, elsewhere on the page I have 
another component which contains a select box and a 'go' button to change the 
number of things displayed on the page. The paged list component is passed into 
this per page selector component as a parameter so it can simply update using a 
setter method since the parameters are all bound together. The components are 
shared across multiple pages and this is working fine.

Now, the per page selector component is going in an area along with another 
component, and this should become a new component. Unfortunately when I try to 
nest my per page selector component in another component like this I get this 
error:

Failure writing parameter 'value' of component 
Results:displayoptionsbar.selectperpageresults.itemsperpage: Failure reading 
parameter 'for' of component Results:displayoptionsbar.selectperpageresults: 
Component Results:displayoptionsbar does not contain an embedded component with 
id 'pagedList'. Available components: selectperpageresults.


Now I can see that I could bubble up an event to the page and have the logic in 
there to set the value into the paged list component explicitly instead of 
relying on the setting of the per page parameter and that being bound back up 
to the page and down to the paged list component, but this would break the 
encapsulation of my per page selector component and duplicate the code on every 
page so I don't want to do that. The problem seems to be passing the paged list 
component reference down two levels so I have access to it... the middle level 
doesn't have the component in the template or in the Java class so it throws 
and error. How should I be doing this?

The parameters of the middle component holding the per page selector component 
look like this:

@Parameter(required=true, defaultPrefix=BindingConstants.COMPONENT)
@Property @SuppressWarnings("unused")
private PagedBase pagedList;

@Parameter
@Property @SuppressWarnings("unused")
private int itemsPerPage;


Hope someone can help me before I go on holiday in five hours? Asking a lot I 
know. ;-)

Thanks,

Andy.

Reply via email to