You need to sign in to do that
Don't have an account?
Mike @ BlackTab
Calling Methods with Parameters From Visualforce
<apex:panelBar > <apex:repeat value="{!OpenProjects}" var="project" id="panelBarItems"> <apex:panelBarItem label="Project Name: {!project.Project_Name__c}"> <apex:detail subject="{!project.ID}" relatedList="false" inlineEdit="true" title="false" rendered="{!showDetails}"/> <apex:panelBar > <apex:repeat value="{!Milestones(project.ID)}" var="milestone"> <apex:panelBarItem label="Milestone Name: {!milestone.Name}"> </apex:panelBarItem> </apex:repeat> </apex:panelBar> </apex:panelBarItem> </apex:repeat> </apex:panelBar>
//Get Milestones Based On Project public List<Milestone__c> getMilestones(ID Project) { return [SELECT Name FROM Milestone__c WHERE Project__c = :Project]; }
I'm trying to call a method "getMilestones" with a parameter called "Project" however i'm getting an apex error: Unknown Function Milestones
where are u calling that function?
I really thought this kind of call would work, too - only because it seems so obvious. Turns out it is not valid syntax - no arguments can be passed in this manner from VF to Apex controllers.
There are some solutions out there that utilize apex:param and rerender but these are limited to command buttons and other actions.
Interesting...Well I solved the problem. I just did an aggragate SOQL query and it did the trick.
Good, but question is still open, can we call apex function with parameter in VF page? I thoughts