You need to sign in to do that
Don't have an account?
AlbertoSM
Help with a Visualforce Page
Hi everyone
I'm witting one of my first Visualforces.This one:
And this controller:
I don't know how to continue. What I know is, I have to define the get method to pass data from the controller to the Visualforce but no idea about where and how to put it.
Thanks in advance for your time!
Cheers!
Alberto
I'm witting one of my first Visualforces.This one:
<apex:page Controller="ScenariosController"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlock > <apex:pageBlockTable value="{!}" var="item" > <apex:column value="{!item.Scenario__c}" style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}"/> <apex:column value="{!item.PCK_Tower_Height__c}" style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}" /> <apex:column value="{!item.NUM_Quantity__c}" style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}" /> <apex:column value="{!item.CHK_Scenario_Principal__c}" style="background-color:{!If(item.CHK_Scenario_Principal__c ==True,'#beecf4', '')}"/> <!-- background-color:{!If(opp.StageName =='Negotiation/Review','#7CFC00',If(opp.StageName =='Closed Won','#DEB887','#DC143C'))}; --> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
And this controller:
public class ScenariosController{ List<Quote_line__c> quoteLineList; //Populate a list with all the quote Lines != NULL ordered by NUM_Scenario__c DESC public List<Quote_line__c> getQuoteLineItems(){ Id budgetId= ApexPages.currentPage().getParameters().get('Id'); if (budgetId!= NULL){ List<Quote_line__c> quoteLineList = new List<Quote_line__c>(); quoteLineList = [SELECT id,name,lkp_product__r.family__c, lkp_product__r.Nominal_Power_MW__c, CHK_Included__c, NUM_Cost__c,LKP_Configurator__c,Sum_mandatory_fields_for_budReq_unfill__C,Date_from__c,Date_to__c, TXT_Tower_First_Value__c, NUM_Quantity__c,LKP_Product__c,MD_quote__c, NUM_Scenario__c, CHK_Scenario_Principal__c FROM quote_line__c WHERE NUM_Scenario__c != NULL ORDER BY NUM_Scenario__c DESC]; } return quoteLineList; } }
I don't know how to continue. What I know is, I have to define the get method to pass data from the controller to the Visualforce but no idea about where and how to put it.
Thanks in advance for your time!
Cheers!
Alberto
You have to do something like this :
instead of this :
Actually there are 2 issues in your code.
1) in VF page - To get data from controller in VF you need to call method getQuoteLineItems without 'get' word. So the correct statement will be.
line #5 -> 2) In your controller you are declaring variable quoteLineList 2 times first at line #3 and then at line #9.
in your case it does not impact but it is not good practice, so just user another name of the variable in your method.
Let me know if it helps you.
Wth your suggestions:
and the visualforce:
Now the VF is showed but it's empty. It seems it doesn't get the data from the controller. There is something wrong in the controller, but I cannot find it.
Thanks!!
Cheers!
Alberto
In the controller you need the following line at the top (as Jeremy wrote above) then you set its value in the code below.