0 Replies Latest reply on Oct 1, 2008 10:24 AM by Johannes Degler

    Too many method calls in a listShuttle

    Johannes Degler Newbie

      I'm using a RichFaces listShuttle to let users order a list of items by multiple attributes. To display the selection between ascending and descending order only when an attribute has been selected in the listShuttle (is on the right side/part of the "targetValue"), I've created a simple method that get's called after every change to the listShuttle.

      Source:

      <rich:listShuttle id="sortColumnsShuttle" var="element" sourceValue="#{ticketOverviewService.availableSortColumns}" targetValue="#{ticketOverviewService.ticketOverview.sortColumns}" converter="#{showSortElementConverter}"
      copyAllControlLabel="Alle hinzufügen" copyControlLabel="Hinzufügen" removeAllControlLabel="Alle entfernen" removeControlLabel="Entfernen"
      bottomControlLabel="Letzter" downControlLabel="Nach unten" topControlLabel="Erster" upControlLabel="Nach oben" targetListWidth="250" sourceListWidth="200">
      
       <rich:column>
       #{element.name}
       </rich:column>
      
      
       <rich:column rendered="#{ticketOverviewService.showSortModeOption(element)}">
       <h:selectOneMenu value="#{element.orderType}">
       <s:convertEnum/>
       <s:enumItem enumValue="DESCENDING" label="Absteigend"/>
       <s:enumItem enumValue="ASCENDING" label="Aufsteigend"/>
       </h:selectOneMenu>
       </rich:column>
      
      
       <a4j:support event="onlistchanged" reRender="sortColumnsShuttle" />
      </rich:listShuttle>
      


      Everything works, but the "showSortModeOption" method gets called over 200 times on each change. The number of calls increases slightly with every item on the right listShuttle side. The method itself is really fast, but calling it that often takes over 1.5 seconds which is just too much.
      Is there any way to reduce the number of method calls?

      I'm using RichFaces 3.2.2.GA, Seam 2.0.2.SP1 and JBoss 4.2.2.GA