You need to sign in to do that
Don't have an account?
harika78
Calculate Salesprice per row in page block table
Hi,
I am displaying a list of products for a pricebook selected. In the pageblock table I have product name, desc,family ,quantity, discount,standard price and salesprice.
I need to calculate the salesprice(discounted price) once the user enters the discount field. How can I do this? I am planning to use a onchange on discount but I could not figure out how to restrict the calculation of salesprice to a particular row.
I am very new to visualforce. Any help is greatly appreciated.
If you want run time rsult quickly at client side then you should JavaScript that will calculate Salesprice and show in next column in same row. but if you want to do all calculation at server side then you need to use Onchange method like as below
<script>
function Calculate(x)
{
// write your calculation logic
passinController(result);
}
</script>
<apex:actionFunction name="passinController" action="{!DoCalculate}" eRender="opId">
<apex:param value="" assignTo="{!Salespfice1}" />
</apex:actionFunction>
<apex:cloum><apex:inputfield value="{!item.discount}" onchange="Calculate(this.value);" /></apex:column>
<apex:column>
<apex:outputText id="opId">{!Salespfice1} </apex:outputText>
</apex:column>
I hope ti will give you much idea & Please let me know in case of any further issue
@Sandeep
Thanks for your quick response.
Can you please elaborate your answer, as I am a newbie I did not understand the vf markup properly.
Thanks much.