tags:

views:

757

answers:

1

Hopefully the title isn't too cryptic ...

The problem we have is that we generate a bunch of input controls (h:inputOneMenu, h:inputText etc) from some Java List.

Works fine EXCEPT the requirement is that these inputs validate on the fly. Again not so hard except that as there controls were generated in a loop the only possible reRender action is basically the entire form or an a4j:outputPanel around each loop iteration which is basically the same thing.

Now the above two solutions technically work but they have the nasty side effect of reRendering all the page controls which makes the page feel really twitchy and clunky. We'd like to stop this from happening so ideally the only control that gets reRendered is the control that send the ajax update/validation.

Basically this is our page code:

<ui:repeat value="#{seam-outjected-list}" var="item">
   <a4j:outputPanel selfRendered="true">
      <h:inputText value=#{item.value}>
         <a4j:support event="onblur" ajaxSingle="true" />
      </h:inputText>
   </a4j:outputPanel>
</ui:repeat>

I've left out a bit of stuff that just renders different controls depending on the item.

As you can see we're currently using the outputPanel solution so every time any loop generated control is updated all the controls are reRendered.

Thanks in advance if anyone has any thoughts.

+1  A: 

My first thought is that you should try replacing your <ui:repeat> with an <a4j:repeat> and take advantage of the ajaxKeys attribute to only reRender certain rows.

From the Richfaces Docs:

The main difference of this component from iterative components of other libraries is a special "ajaxKeys" attribute. This attribute defines row keys that are updated after an Ajax request. As a result it becomes easier to update several child components separately without updating the whole page.

Damo