-
1. Re: Referencing components by id inside iteration tag
nbelaevski Dec 20, 2009 5:04 PM (in response to piotr.sobczyk)Hi,
Please take a look at what Max Katz is writing about "ajaxKeys" attribute: http://java.dzone.com/articles/an-introduction-to-jboss-richf?page=0,5
-
2. Re: Referencing components by id inside iteration tag
piotr.sobczyk Jan 13, 2010 4:26 PM (in response to nbelaevski)And what if I would like to reRender just spectfic component from table row not all the row? I would have to assign id for that component and because it's in the a:repeat it would fail with "not unique id" error. Is there any good solution for problem of rerendering single component from table row?
I know I can point only a single column to be reRendered as in article but it's still to few for us .
-
3. Re: Referencing components by id inside iteration tag
nbelaevski Jan 13, 2010 5:50 PM (in response to piotr.sobczyk)Hi Piotr,
Can you please clarify on this:
piotr.sobczyk wrote:
I would have to assign id for that component and because it's in the a:repeat it would fail with "not unique id" error
? This should be working and you should be able to re-render arbitrary nested component by specifying its "id" as target for "reRender" and defining the rows to update via "ajaxKeys" attribute.
-
4. Re: Referencing components by id inside iteration tag
piotr.sobczyk Jan 13, 2010 10:46 PM (in response to nbelaevski)Thanks for answer, Nick and sorry for being unclear.
First, I don't know why I wrote "inside a:repeat", it should by "inside rich:dataTable" there. Sorry for misinformation.
Maybe we are doing something wrong.We are using Facelets as templating system and insert template into table column in such way:
<rich:table id="productsTable" ...>
...
<rich:column>
<ui:include src="/components/productCard.xhtml">
<ui:param name="product_" value="#{_row.orderedProduct}"/>...
</ui:include></rich:column>
...
</rich:table>
I just tried to assign id to tag outside facelets template in this column and everything works fine so it's technically correct what you said.
But If we assign id to any tag inside Facelets template that is nested inside iteration tag like rich:dataTable, we are getting "duplicate Id for a component exception". For example if tag with id assigned has id
"productCard-packings"
, the exception message is:java.lang.IllegalStateException: duplicate Id for a component j_id10:productsTable:productCard-packings
at org.ajax4jsf.application.TreeStructureNode.apply(TreeStructureNode.java:68)Now I see that it's Facelets specific issue and in worst case we can resign from using template in this place but I'm sure there is some solution and it isn't necessary (it would be bad to resign from reusability).
-
5. Re: Referencing components by id inside iteration tag
nbelaevski Jan 14, 2010 9:34 AM (in response to piotr.sobczyk)Is included page used several times inside the data table? Try wrapping included page contents into f:subview tag.1 of 1 people found this helpful -
6. Re: Referencing components by id inside iteration tag
piotr.sobczyk Jan 14, 2010 1:13 PM (in response to nbelaevski)Thanks a lot, Nick. It seems it works well now! I guess I will have to read a bit about <f:subview> tags, because I don't understand the magic that made it working .
EDIT: Allright, I see that <f:subview> is kind of "namespace" that makes id's of all components contained inside it unique.
-
7. Re: Referencing components by id inside iteration tag
nbelaevski Jan 14, 2010 2:06 PM (in response to piotr.sobczyk)It's instance of NamingContainer interface, like h:form, h:dataTable, rich:tree (the list can be continued...) are.