Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I got stuck in a scenario. I have a pageBlockTable and in that I have 3 columns with a dataTable in the 3rd column. I have a commandLink in that column, and when I click on that all records are rendered, but I need to render only that particular record's dataTable.

Please have a look at the Visualforce page. Can you let me know how to render according to a particular record?

<apex:page controller="repeatcontroller" > 
 <apex:form > 
  <apex:pageBlock > 
   <apex:pageBlockTable value="{!CallplanAccounts}" var="status" border="0" cellpadding="6" cellspacing="13" columnsWidth="3"> 
    <apex:column headerValue="Name"> 
     {!status.acc.Name}   
    </apex:column> 
    <apex:column headerValue="Status"> 
     {!status.acc.Active__c}   
    </apex:column> 

    <apex:column > 
     <apex:commandLink action="{!Callstatus}" id="renderit" > 
      CallString<apex:param name="cmid" value="{!status.acc.id}" assignTo="{!approveid}" /> 
     </apex:commandLink> <br/> 

     <apex:outputPanel rendered="{!visible_comment =='show'}" > 
      <apex:dataTable value="{!status.acc.Call_Strings__r}" var="cm" > 
       <apex:column headerValue="Callstring name" > 
        {!cm.name} 
       </apex:column> 
       <apex:column headerValue="Origianl values" > 
        {!cm.Original_CallString__c} 
       </apex:column> 
       <apex:column headerValue="Updated values" > 
        <apex:outputField value="{!cm.Updated_CallString__c }" > 
         <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton" / > 
        </apex:outputfield> 
       </apex:column> 
      </apex:dataTable> 
     </apex:outputPanel> 
    </apex:column> 
   </apex:pageBlockTable> 
 </apex:pageBlock> 
 </apex:form> 
</apex:page>
share|improve this question
    
did you try pringint visible_comment on the page? I believe it is not coming as 'show'. –  doga Feb 1 '13 at 6:49
add comment

3 Answers 3

up vote 0 down vote accepted

I think your problem is that you don't have a reRender tag in your command link. Without that after clicking a whole page is just reloaded. Try to insert reRender="XXX". Something like this:

<apex:column > 
    <apex:commandLink action="{!Callstatus}" id="renderit" reRender="myPanel"> 
    CallString<apex:param name="cmid" value="{!status.acc.id}" assignTo="{!approveid}" /> 
    </apex:commandLink> <br/> 

    <apex:outputPanel rendered="{!visible_comment =='show'}" id="myPanel">
    // your stuff    
    </apex:outputPanel>

</apex:column> 
share|improve this answer
    
This was my original thought as well, but I am concerned this may not work in his situation. The issue I am concerned with is the fact that your outputPanel with id of myPanel will actually be duplicated along the page multiple times since it is nested in a pageBlockTable. I am not really sure how to handle this. I would probably rerender the entire pageBlockTable depending on performance. Are you sure this works with the ID on the outputPanel inside the column? –  Jesse Altman Feb 1 '13 at 14:56
    
Added rerender as you said. but no effect. –  Arun SFDC Feb 4 '13 at 7:04
add comment

By looking at the code, it appears to me that the variable "visble_comment" is not associated with every record( Would be easy if you could post the controller code as well). And if that the case, the output is but obvious.You may need to use a WRAPPER class to associate "visible_comment" with every record.

share|improve this answer
    
Heres is the callstatus method.. –  Arun SFDC Feb 4 '13 at 6:45
    
I think you forgot to add the Code :) –  Shailesh Deshpande Feb 4 '13 at 8:41
add comment

I think the rerender attribute on the command link will solve the problem. I am more concerned with callStatus function which on the controller should read the approveid and populate the arraylist status.acc.Call_Strings__r. From an UI perspective, i think your output would really be clumsy with this design. I would take the datatable outside the pageblock and make it display only on clicking the command link. That way the panel would open on the right side of the current datatable. So the real issues which are problematic are rerender attribute and your callstatus function which should repopulate the arraylist everytime. Put a system debug on the function and it should solve the problem Buyan

share|improve this answer
    
Thanks for the reply. –  Arun SFDC Feb 4 '13 at 6:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.