You need to sign in to do that
Don't have an account?
Shephali Swarnkar
apex:detail
Hi All,
Below is my code which i have written to display the records.i have multiple tables(showing one at time as per choice given). and in table one field i made it a link so that i can get details of that records. In this code there is no error, when i am clicking any of the link first time which are populated it displays the details of that records but when i click second time to any other link it is not showing anything. why i can't get.
------------------VF code--------------------------
<apex:pageBlockTable value="{!num_con}" style="" var="cn" rendered="{!If(showTable == 'donotcall',true,false)}">
<apex:column headerValue="Name">
<apex:commandLink value="{!cn.Name}" reRender="block1">
<apex:param name="p1" value="{!cn.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!cn.Account.Name}"/>
<apex:column value="{!cn.DoNotCall}"/>
<apex:column value="{!cn.mobilephone}"/>
<apex:column value="{!cn.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock id="block1">
<apex:detail subject="{!$CurrentPage.parameters.p1}" relatedList="false"/>
</apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock>
---------------------------------------Controller Code---------------------------
public void reject()
{
showTable = 'donotcall';
num_con=[select Name, Email, MobilePhone, Account.Name, Phone, LeadSource,DoNotCall from Contact where rejectcontact__c='yes' and owner.alias=: Alias];
}
Below is my code which i have written to display the records.i have multiple tables(showing one at time as per choice given). and in table one field i made it a link so that i can get details of that records. In this code there is no error, when i am clicking any of the link first time which are populated it displays the details of that records but when i click second time to any other link it is not showing anything. why i can't get.
------------------VF code--------------------------
<apex:pageBlockTable value="{!num_con}" style="" var="cn" rendered="{!If(showTable == 'donotcall',true,false)}">
<apex:column headerValue="Name">
<apex:commandLink value="{!cn.Name}" reRender="block1">
<apex:param name="p1" value="{!cn.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!cn.Account.Name}"/>
<apex:column value="{!cn.DoNotCall}"/>
<apex:column value="{!cn.mobilephone}"/>
<apex:column value="{!cn.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock id="block1">
<apex:detail subject="{!$CurrentPage.parameters.p1}" relatedList="false"/>
</apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock>
---------------------------------------Controller Code---------------------------
public void reject()
{
showTable = 'donotcall';
num_con=[select Name, Email, MobilePhone, Account.Name, Phone, LeadSource,DoNotCall from Contact where rejectcontact__c='yes' and owner.alias=: Alias];
}
Please try the below snippet.
Kindly mark it as a solution if that works.
Thanks for reply but its not working the problem is same its showing detail records of the very first selected record link.
I have modified the below snippet and tested it out. I have done a couple of changes in the pageblock tags. Ensure that you include the same in your code.
The problem with rendered="{!If(showTable == 'donotcall',true,false)}" in <apex:pageBlockTable> if i remove the code works properly. but after removing this attribute it will show the table structure initially with blank data which i need to ignore. in that case how to achieve both the things like ignoring the structure of table as well as shwing records for each link.
Thanks
Shephali