Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- General Development
- :
- Pass Value from to pageBlockTable Row to Controlle...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Pass Value from to pageBlockT able Row to Controller
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-15-2013 12:20 PM
I load data into a PageBlockTable in edit mode. I want to allow the users to edit the Quantity and Unit Price. When either of these values are changed I need my Total Price to change. Currently I am trying to get the Value from the Quantity field and display it the "Rerender Example" section just to see if the value is being passed and it always comes up blank. I am using actionSupport. I know I am missing something that connects these together but I can't figure out what from all the examples I have found on line.
1) How do I pass the value of a row to the controller to modify another value on the same row?
VF page code:
<apex:page Controller="dataListCon1" id="thePage">
<apex:form ID="Selling">
<apex:pageBlock title="Mass Edit" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!ypItems}" var="yp" ID="theTable" rowClasses="odd,even" styleClass="tableClass">
<apex:facet name="caption"></apex:facet>
<apex:column >
<apex:facet name="header">Name</apex:facet>
<apex:outputText value="{!yp.name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Product Name</apex:facet>
<apex:outputText value="{!yp.yptrimble__Product__r.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Quantity</apex:facet>
<apex:inputField ID="Quantity" value="{!yp.yptrimble__Quantity__c}" required="true" >
<apex:param name="para" value="{!yp.yptrimble__Quantity__c}" assignTo="{!para}"/>
<apex:actionSupport event="onchange" rerender="qvalue" status="refreshstatus"/>
</apex:inputField>
</apex:column>
<apex:column >
<apex:facet name="header">Unit Price</apex:facet>
<apex:inputField ID="UnitPrice" value="{!yp.yptrimble__Unit_Price__c}" required="true" />
</apex:column>
<apex:column >
<apex:facet name="header">Total Price</apex:facet>
<apex:outputText ID="TotalPrice" value="{!yp.yptrimble__Total_Price__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Service Date</apex:facet>
<apex:outputText value="{!yp.yptrimble__Service_Date__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock >
<apex:sectionHeader title="Rerender Example"/>
<apex:actionStatus id="refreshstatus" startstyle="color:green;" startText="Refreshing...."></apex:actionStatus>
<apex:outputpanel id="qvalue">
<apex:outputtext value="{!para}"/>
</apex:outputpanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller Code:
public class dataListCon1 {
public String para{
get;
set{
para= value;
}
}
public dataListCon1() {
}
List<yptrimble__Quote_Line_Item__c> ypItems;
public List<yptrimble__Quote_Line_Item__c> getYpitems()
{
if(ypItems== null) ypItems= [select name,id,YPTRIMBLE__QUANTITY__C,YPTRIMBLE__SERVICE_
YPTRIMBLE__TOTAL_PRICE__C,YPTRIMBLE__UNIT_PRICE__C
from yptrimble__Quote_Line_Item__c
where YPTRIMBLE__QUOTE__C =:ApexPages.currentPage().getParameters().get('Id'
return ypItems;
}
public PageReference save()
{
Update ypItems;
PageReference pageRef = new PageReference('https://cs17.salesforce.com/' + ApexPages.currentPage().getParameters().get('Id'))
return pageRef;
}
public PageReference cancel()
{
PageReference pageRef = new PageReference('https://cs17.salesforce.com/' + ApexPages.currentPage().getParameters().get('Id'))
return pageRef;
}
}

