You need to sign in to do that
Don't have an account?
VisualForce page with table
i am trying to get a custom object and its related items to show in a table in a visualforce page. Currently i have the first object showing up but i am not sure how to pull in the related list
here is the controller
global with sharing class poistionController {
private Map<string,set<String>> employeeMap=new Map<string,set<String>>();
public Employees__c pos{get;set;}
public poistionController() {
list<Training__C>trainList=[Select name from Training__C where employee__C=:employees__C.Name__c];
pos = [select ID, Name, Active__C from Employees__c where Active__C= true];
}
}
and here is the page
<apex:page controller="poistionController" showHeader="false">
<apex:relatedList list="Training__C"/>
<apex:pageblock title="test">
</apex:pageblock>
<apex:dataTable value="{!pos}" var="Employee">
<apex:column value="{!pos.name}">
</apex:column>
<apex:column value="{!pos.id}">
</apex:column>
</apex:dataTable>
</apex:page>
I think what you need is a nested apex:repeat - given that you have what looks like two related objects.
Just taking a wild hack at your problem, see if this is sorta/kinda what you're looking for;
Page:
Controller:
PS- There are much more eloquent ways to build maps of lists - this is just an example.
Plus - this solution might not at all match your problem -- because in the "typical" class/pupil problem, there is a many to many relationship -- multiple pupils can take multiple classes, and vice-versa. If that is your case, you'll need to build a junction object to link the employees to your classes.