0

I have sth like this:

<a4j:repeat value="#{results}" var="hdr" rowKeyVar="idx">
   <rich:dataTable var="item" value="#{results}" id="tbl#{idx}" first="#{idx}" rows="1">
       <a4j:commandButton value="update this table only" reRender="tbl#{idx}" />
   </rich:dataTable>
</a4j:repeat>

When I check from the output html, the data table has id like form:0:tbl that has no idx at the end.

The reRender will work when there is only one row in the results.

So here comes some questions:

  1. Why doesn't dataTable's id works with EL expression while the "first" attribute works nicely?
  2. How does reRender work that even I just specify tbl it can still be resolved while the actual HTML id is something longer like form:0:tbl? (if I know how does reRender work, I maybe able to hack it to work with a4j:repeat...)
  3. Is there any technique or workaround that I could use to refresh only a specific dataTable that is inside a4j:repeat?

In fact I have successfully reRendered the whole a4j:repeat block surrounded by s:div. But refreshing the whole block would reset the scrollbar so it isn't desired....

nothize
  • 108
  • 1
  • 7

2 Answers2

0

For 1, it is possible that the life cycle of the table is in a different phase.

For 2, it refers to UIComponent.findComponent in fact for looking up a component given an ID.

For 3, perhaps try to use UIComponent.findComponent() or #{rich:clientId('id')} to see whether the actual HTML element ID of the a4j:repeat embedded rich:dataTable to be retrieved.

If yes, then somehow reRender can be made to work. If no, look if there is anything that can override how reRender looks for component.

nothize
  • 108
  • 1
  • 7
0

Okay latest experiment shows that simply using the rich:dataTable id can do.

Keys to remember:

  1. Inside a4j:repeat, the absolute name of the id of dataTable will have something like :0: :1: for the corresponding index.
  2. However, to locate it, simply using the same id as defined in rich:dataTable is okay. Don't append any suffix at the end.
  3. When observing the ajax data from Chrome, the reRendered portion is just the same related dataTable of the component.

Conclusion, think too much, failed to try the simplest solution at the start.

nothize
  • 108
  • 1
  • 7