1

I have apex class below having my_list as a List. I need to display in apex page.

Apex class:

global with sharing class poistionController {

 List<HCP_Depth_Tracker_OAPI__c> my_list = new List<HCP_Depth_Tracker_OAPI__c>();

 public poistionController(Apexpages.StandardController Account) {

     my_list= [select Monthly_Call_Attainment_OAPI__c,Name,Account_OAPI__c,Active_HCP_DT_OAPI__c,Id,Territory_OAPI__c,Total_Actual_Calls_Month_OAPI__c from HCP_Depth_Tracker_OAPI__c where Depth_Tracker_OAPI__r.Account_OAPI__c = :ApexPages.currentPage().getParameters().get('id')];

  }

}

Apex page:

    <apex:dataList value="{!my_list}" var="c">
      {!c}
</apex:dataList>

</apex:pageBlock> 

But it is not working . Can someone help me here?

1
  • Do you have a getter for your list ?
    – SF_user
    Aug 26 '14 at 13:54
2

You need to initialize your List variable and make it public:

public List<HCP_Depth_Tracker_OAPI__c> my_list { get; set; }

public poistionController(Apexpages.StandardController Account) {
     my_list= [select ...];
}
4
  • Hi mast0r! Incorporated the change but it is not showing all the field values Aug 26 '14 at 14:11
  • @saikat You need to set it on the visualforce page by yourself like this: {!c.Name}, {!c.Account_OAPI__c} and so on. Aug 26 '14 at 14:13
  • @Mastor! Yes. But that is not showing the column names in table format Aug 26 '14 at 14:15
  • @saikat Use apex:pageBlockTable for that. Docs could be found on the internet. Aug 26 '14 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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