You need to sign in to do that
Don't have an account?
mba75
<apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" var="opplis" id="line_items" >
<apex:column headerValue="Action">
<apex:commandLink rerender="Mode">Modif
<apex:param name="Modif_mode" value="true" assignTo="{!Modif_mode}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
passing a parameter from a pageBlockTable commandlink to the controller
I basically want to hide some panel in my page to do that I want to update the variable Modif_mode :
The default Value is false this value should be update to true when I click on my commandLink but nothing happen
Any Idea ?
<apex:outputpanel id="Mode">
<apex:outputlabel value="{!Modif_mode}" />
</apex:outputpanel>
<apex:outputlabel value="{!Modif_mode}" />
</apex:outputpanel>
<apex:pageBlockTable value="{!Opportunity.OpportunityLineItems}" var="opplis" id="line_items" >
<apex:column headerValue="Action">
<apex:commandLink rerender="Mode">Modif
<apex:param name="Modif_mode" value="true" assignTo="{!Modif_mode}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
controller :
Boolean Modif_mode = false;
public boolean getModif_mode() {return Modif_mode;}
public Void setModif_mode (Boolean b) { Modif_mode = b; }
<apex:commandLink rerender="Mode" value="Modif" action="{!doSwitch}"/>
Also I think you should be using outputText instead of outputLabel.
<apex:outputpanel id="fam_prod" rendered="{!if(Modif_mode=true,'false','true')}">
<apex:outputLabel value="Product Family:" for="family"/>
<apex:actionRegion >
<apex:selectList value="{!family}" size="1" id="families" >
<apex:actionSupport event="onchange" rerender="Products,Rate_types,Plans"/>
<apex:selectOptions value="{!families}"/>
</apex:selectList>
</apex:actionRegion>
<apex:outputLabel value="Product:" for="Products"/>
<apex:actionRegion >
<apex:selectList value="{!Product}" size="1" id="Products" disabled="{!ISNULL(family)}">
<apex:selectOptions value="{!Products}"/>
<apex:actionSupport event="onchange" rerender="Rate_types,Plans"/>
</apex:selectList>
</apex:actionRegion>
</apex:outputpanel>
So i click the button, it passes a variable from my datatable (ID of custom object) to a controller method, which redirects to a new page using that parameter.
The issue here is that the value of the parameter is a variable from my datatable, not just true or false.
page code:
<apex:form >
<apex:pageBlock title="">
<apex:dataTable value="{!detailedAvailability}" var="ava" styleClass="list">
<apex:column headerValue="Resource">
<apex:outputText value="{!ava.empFirstName} {!ava.empLastName}"/>
<apex:column headerValue="Option">
<apex:commandButton action="{!onClickBook}" value="Book Now" id="theButton">
<apex:param value="{!ava.empId}" assignTo="{!empId2}" />
</apex:commandbutton>
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:form>
controller
.....
String empId2 = null;
public void setEmpId2(String emp) { empId2 = emp;}
public String getEmpId2() { return empId2; }
public PageReference onClickBook() {
PageReference pageRef = new PageReference('/' + empId2);
pageRef.setRedirect(true);
return pageRef;
}
......
I've simplyfied what im doing here for this example, as i will be using the returned paramter in a query etc. The code works fine besides the fact the parameter empId2 doesn't update when the button is clicked. i.e. if i put {!ava.empId} in the value field of the
command button is displays the relevant employeeID per line, just can;t seem to pass it to my controller (it stays null)!
any help appreciated.