You need to sign in to do that
Don't have an account?
Christopher Pezza
Grouping in Repeats
I am looking to repeat a list with groups so that the result looks like this
Category Name
Feature Name Feature Status
Category Name
Feature Name Feature Status
How would i write my code for this i have this as my example but it produces no results when i know there are 100+
Class
Page
Category Name
Feature Name Feature Status
Category Name
Feature Name Feature Status
How would i write my code for this i have this as my example but it produces no results when i know there are 100+
Class
public Id CHid {get;set;} public class FCHArea { public List<FCH_Joins__c> lichjoins {get; set;} public string strAreaName {get; set;} public FCHArea(FCH_Joins__c sJoins) { strAreaName = sJoins.nCino_Feature__r.nCino_Feature_Category__r.Name; lichjoins = new List<FCH_Joins__c>{sJoins}; } } public List<FCHArea> liAreas {get; set;} private Map<string, FCHArea> mapAreas = new Map<string, FCHArea>(); Public nCino_CHIndividualController() { Chid = Apexpages.currentPage().getParameters().get('ID'); for(FCH_Joins__c sJoins : [SELECT Id, Name, Status__c, nCino_Feature__r.Name FROM FCH_Joins__c WHERE Customer_Health__c = :CHid]) { if(mapAreas.get(sJoins.nCino_Feature__r.nCino_Feature_Category__r.Name) == null) { mapAreas.put(sJoins.nCino_Feature__r.nCino_Feature_Category__r.Name, new FCHArea(sJoins)); liAreas.add(mapAreas.get(sJoins.nCino_Feature__r.nCino_Feature_Category__r.Name)); } else { mapAreas.get(sJoins.nCino_Feature__r.nCino_Feature_Category__r.Name).lichjoins.add(sJoins); } } }
Page
<apex:repeat value="{!liAreas}" var="a"> <div class="col-lg-6"> <table class="table table-hover"> <thead> <tr> <th colspan="2" class="text-center">The Name</th> </tr> </thead> <tbody> <apex:repeat value="{!a.lichjoins}" var="c"> <tr> <th>{!c.nCino_Feature__r.Name}</th> <apex:outputPanel rendered="{!c.Status__c == 'Yes - Successfully'}"> <td class="bg-green">{!c.Status__c}</td> </apex:outputPanel> <apex:outputPanel rendered="{!c.Status__c == 'Yes - Needs Improvement' || c.Status__c == 'Yes - Piloting' || c.Status__c == 'No - Implementing'}"> <td class="bg-yellow">{!c.Status__c}</td> </apex:outputPanel> <apex:outputPanel rendered="{!c.Status__c == 'No - Needs Revisiting'}"> <td class="bg-red">{!c.Status__c}</td> </apex:outputPanel> <apex:outputPanel rendered="{!c.Status__c == 'No - Not Applicable'}"> <td>{!c.Status__c}</td> </apex:outputPanel> </tr> </apex:repeat> </tbody> </table> </div> </apex:repeat>
Hope below code will help you.
Class
Page
Please mark as a solution if it helps you.