You need to sign in to do that
Don't have an account?
mattdarnold
Visualforce: commandLink / param not working in dataTable
Hi - I am trying to create a simple visualforce page that displays a dataTable of opportunities and then provides a commandLink within each row that when clicked changes the Forecast_Category__c field to 'Medium'. This works, however, only for the final row of the dataTable. I also tried this using a pageBlockTable and it worked, but only for the first record.
Thanks for any help -- Matt
Here is my page:
And, here is my controller:
Thanks for any help -- Matt
Here is my page:
Code:
<apex:page controller="forecastController" title="Forecast Report">
<apex:form id="theForm">
<apex:dataTable value="{!OppsHigh}" var="opp" id="theTable" cellpadding="4">
<apex:column >
<apex:facet name="header">Link</apex:facet>
<apex:commandLink action="{!updateOpp}" value="M" id="theCommandLink" rerender="theTable">
<apex:param value="{!opp.id}" assignTo="{!oppId}" />
</apex:commandLink>
</apex:column>
<apex:column >
<apex:facet name="header">Name</apex:facet>
<apex:outputText value="{!opp.name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Forecast Category</apex:facet>
<apex:outputText value="{!opp.Forecast_Category__c}"/>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:page>
And, here is my controller:
Code:
public class forecastController {
public ID oppId;
public void setOppId(ID i) { oppId = i; }
public ID getOppId() { return oppId; }
public List<Opportunity> getOppsHigh() {
List<Opportunity> opps = [select
id,
name,
CloseDate,
Type,
Forecast_Category__c
from Opportunity
where Forecast_Category__c = 'High'];
return opps;
}
public void updateOpp() {
Opportunity opp = [select
id,
name,
CloseDate,
Type,
Forecast_Category__c
from Opportunity
where id =:oppId limit 1];
opp.Forecast_Category__c = 'Medium';
update opp;
}
}
in the page
in the controller
also updateOpp() should return a pageReference, null is fine.
-- Matt
this method is simpler, for this case.
<tr>
<td>
Annualrevenue:<apex:outputtext value="{0,number, 000,000}">
<apex:param value="{!value('123456789')}"/>
</apex:outputtext>
</td>
</tr>
the above code working as per my requirement. but the below code not working, [accobject.annualrevenue__c] is my text field and i am giving the value 123456789, but i have to display that value 123,456,789
<tr>
<td>
Annualrevenue:<apex:outputtext value="{0,number, 0,00}">
<apex:param value="{!value(accobject.annualrevenue__c)}"/>
</apex:outputtext>
</td>
</tr>
please anyone help me , how to display mytext field, in number format. my field should be text,