2

I have a controller with extesion from which I try to pass the subtitle values to my visualforce page but I cant seem ro render it.

My system.debug('subtitle 1 '+ subtitle ); gives : subtitle 1 {Demo, Final}

Here is my VFP:

<apex:page standardController="Quote__c"  extensions="quotelineItems" contentType="application/msword#Quote {!Quote__c.Name}.doc" cache="true" >
  <html xmlns:w="urn:schemas-microsoft-com:office:word">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <head>
      <style>
      </style>
    </head>
  <body style="font-family:Tahoma,serif;font-size: 11pt;margin:2cm;">
    <apex:repeat var="subt" value="{!subtitle}">
      {!subt}<br/>
    </apex:repeat>
  </body>
  </html>
</apex:page>

Controller:

global with sharing class quotelineItems {

    global set<string>  subtitle {get;set;}
    public String currentRecordId {get;set;}

    public quotelineItems(ApexPages.StandardController controller) {
    currentRecordId = ApexPages.CurrentPage().getparameters().get('id');

    List<Quote_Line_Item__c> myQli = [SELECT id, Subtitle__c, Quote__c FROM Quote_Line_Item__c  WHERE Quote__c =:currentRecordId ORDER by Subtitle__c]; 

    set<string> subtitle = new set<string>();  
        for(Quote_Line_Item__c q : myQli ) {
            subtitle.add(q.Subtitle__c );
        }
        system.debug('subtitle 1 '+ subtitle );
        Apexpages.currentPage().getHeaders().put('content-disposition', 'inline; filename='+myQli[0].Quote__c+'-'+date.today().format()+'.pdf');
    } 

    public set<string> getsubtitle() { 
        system.debug('subtitle 2 '+ subtitle );
        return subtitle;
    } 
}
0

1 Answer 1

5

You are setting a local variable rather than your controller property.

Change:

Set<String> myProperty { get; set; }
public MyExtension(ApexPages.StandardController controller)
{
    Set<String> myProperty = new Set<String>();
}

To:

Set<String> myProperty { get; set; }
public MyExtension(ApexPages.StandardController controller)
{
    myProperty = new Set<String>();
}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .