function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Colin LoretzColin Loretz 

Multiple Dependent SelectLists

Howdy all,

I've implemented dependent selectLists in the interface below. The issue I'm having is that the lists only work when only 1 set exists. IE: 1 row for time entry in this case. When I add a row to the interface, it creates a new timeEntry instance and the selectLists in the bottom-most row work properly, but any above that do not work.

Is there a way to dynamically rerender a row in a table or some VF component? Ideally, each row or each outputPanel would have a different ID but I can't seem to set the rerender="" attribute dynamically.

Code:
<apex:actionRegion >
<apex:selectList value="{!selectedProject}" size="1">
<apex:selectOptions value="{!ProjectOptions}" />
<apex:actionSupport event="onchange" rerender="mondayTask" status="loading" />
</apex:selectList>
</apex:actionRegion>                  

<apex:outputPanel id="mondayTask">
<apex:selectList value="{!taskId}" size="1" multiselect="false">
<apex:selectOptions value="{!taskItems}"/>
</apex:selectList>
</apex:outputPanel>




Here is the code for the VF section:
Code:
<apex:outputPanel id="mondayTable"> 

 <apex:form >
 <table cellpadding = "0" cellspacing = "0">
  <tr class = "header">
        <td>Projects</td>
        <td>Tasks</td>
        <td>Description</td>
        <td width = "50">Time</td>
       </tr>
  <apex:repeat value="{!mondayTime}" var="t">
 <tr>
  <td>
   <apex:actionRegion >
          <apex:selectList value="{!selectedProject}" size="1">
           <apex:selectOptions value="{!ProjectOptions}" />
     <apex:actionSupport event="onchange" rerender="mondayTask" status="loading" />
          </apex:selectList>
         </apex:actionRegion>                  
        </td>
        <td>
   <apex:outputPanel id="mondayTask">
          <apex:selectList value="{!taskId}" size="1" multiselect="false">
         <apex:selectOptions value="{!taskItems}"/>
       </apex:selectList>
         </apex:outputPanel>
        </td>
  <td><apex:inputText value="{!t.description}" /></td>
  <td><apex:inputText value="{!t.hours}" /></td>
 </tr>
  </apex:repeat>
  <tr>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td>&nbsp;</td>
   <td><apex:commandButton action="{!addEntry}" value="add row" rerender="mondayTable" status="loading"/></td>
   <td><apex:commandButton action="{!saveMondayTime}" value="save" /></td>
  </tr>
 </table>
 </apex:form>
 </apex:outputPanel>

 



steve_andersensteve_andersen
When I looked into doing inline editing in a table like this, I couldn't find a way to rerender the right cells. In a repeat like this, I don't think you can rerender within a row without using javascript.

I surely am not the expert on this, I didn't get an answer when I started to ask about it: http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=2632#M2632

Steve
dchasmandchasman
Rerendering at the row/column/cell level can typically be accomplished using apex:outputPanel "wrappers" around the area(s) you would like to target. It is a known limitation that you directly targeting apex:column for rerender does not work correctly - its on our backlog to fix in a future release.
Colin LoretzColin Loretz
Doug,

Thanks for your input. I'll probably just remove the ability to do multiple entries on a single day for the time being and tackle the issue again once I get the app out to my users.

Thanks!
Colin
TehNrdTehNrd

I'm sort of bring this thread back from the ashes but...

Colin,

 

Did you ever figure a way to rerender just the row in which some event occurs? I have a similar example where a change is made in one row and this is really the only this row needs to be rerendered but I am either rerendering entire columns or the entire table. Everything works fine but when the table size becomes larger the rerender becomes slower. It's by no means super slow and is definetly usable but if there is a way to optimize why not?