Skip to main content
John Neff (Ring2Media) 님이 #Visualforce에 질문했습니다
Hello, 

I have a pageBlock, inside of which I am using apex:repeat to output values in a table

<apex:repeat value="{!listOfAQ}" var="aq">

On the controller, listOfAQ pulls in field values from a specific set of records: 

listofAQ = [Select id, name, Routing_Status__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_LN__c, Sales_Origination_Date__c from Buyer__c WHERE Pipeline_Status__c = 'AQ' ORDER BY Sales_Origination_Date__c DESC];

I would like to take the field value of Sales_Quarter__c from listofAQ and make that the title of my page block.  The field value of Sales_Quarter__c will be the same for all records in the set - I would just like to grab one of the records and somehow pass that value to the pageBlock title.  Is this possible in any way?

Thanks in advance! 

 
답변 2개
  1. 2016년 4월 27일 오후 3:26
    You can do something like this :

    public with sharing class YOURCLASS

    {

     public String strTitle {get;set;}

    // Rest of your code along with listOfAQ query 

    strTitle = '';

    if(!listOfAQ.isEmpty)

    strTitle = listOfAQ[0].Sales_Quarter__c;

    // Rest of your code

    }

    Now use the title in your pageblock :

    <apex:pageblock title="{!strTitle}" >

     
0/9000