You need to sign in to do that
Don't have an account?
Vivek Viswanath
Issue with Action Support in IE
The following code works for Firefox and shows the total however it fails for IE . I am trying to execute the Action support on the Change event of the Apex table. I tried moving the action support to inside the column tag however it then works only for the first row but dose not work for Firefox. Please let me know if there is anything I am doing wrong here. The code here works for Firefox.
<apex:page id="Test_Action_Support" controller="Test_Action_Support_Controller" action="{!init}" rendered="true" >
<apex:outputPanel >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable width="550" value="{!accts}" var="itemsToOrder">
<apex:actionSupport event="onchange" action="{!calTotalHistoricalRevenue}"rerender="tableTotal" />
<apex:column headerValue="Item Listed">
<apex:inputfield value="{!itemsToOrder.HS_Total_Available_Heart_Smart_Points__c}"/>
<apex:facet name="footer">
Total Cost of Reg Kit Items:
</apex:facet>
</apex:column>
<apex:column headerValue="Quantity">
<apex:facet name="footer">
<apex:outputPanel id="tableTotal">
<apex:outputText value="{!totalHistoricalRevenue}"></apex:outputText>
</apex:outputPanel>
</apex:facet>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form >
</apex:outputPanel>
</apex:page>
public class Test_Action_Support_Controller
{
public List <Account> accts= new List <Account>();
public Double totalHistoricalRevenue = 0;
public List <Account> getaccts()
{
return accts;
}
public Double gettotalHistoricalRevenue()
{
return totalHistoricalRevenue;
}
// init function that gets the accounts
public void init()
{
accts = [select HS_Total_Available_Heart_Smart_Points__c from Account limit 10];
}
// THis is the function to calculate the total to be called by the action support
public PageReference calTotalHistoricalRevenue()
{
for (account acct : accts)
{
if(acct.HS_Total_Available_Heart_Smart_Points__c!=null)
{
totalHistoricalRevenue = totalHistoricalRevenue + acct.HS_Total_Available_Heart_Smart_Points__c;
}
}
return null;
}
}
<apex:page id="Test_Action_Support" controller="Test_Action_Support_Controller" action="{!init}" rendered="true" >
<apex:outputPanel >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable width="550" value="{!accts}" var="itemsToOrder">
<apex:actionSupport event="onchange" action="{!calTotalHistoricalRevenue}"rerender="tableTotal" />
<apex:column headerValue="Item Listed">
<apex:inputfield value="{!itemsToOrder.HS_Total_Available_Heart_Smart_Points__c}"/>
<apex:facet name="footer">
Total Cost of Reg Kit Items:
</apex:facet>
</apex:column>
<apex:column headerValue="Quantity">
<apex:facet name="footer">
<apex:outputPanel id="tableTotal">
<apex:outputText value="{!totalHistoricalRevenue}"></apex:outputText>
</apex:outputPanel>
</apex:facet>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form >
</apex:outputPanel>
</apex:page>
public class Test_Action_Support_Controller
{
public List <Account> accts= new List <Account>();
public Double totalHistoricalRevenue = 0;
public List <Account> getaccts()
{
return accts;
}
public Double gettotalHistoricalRevenue()
{
return totalHistoricalRevenue;
}
// init function that gets the accounts
public void init()
{
accts = [select HS_Total_Available_Heart_Smart_Points__c from Account limit 10];
}
// THis is the function to calculate the total to be called by the action support
public PageReference calTotalHistoricalRevenue()
{
for (account acct : accts)
{
if(acct.HS_Total_Available_Heart_Smart_Points__c!=null)
{
totalHistoricalRevenue = totalHistoricalRevenue + acct.HS_Total_Available_Heart_Smart_Points__c;
}
}
return null;
}
}
What I said is that table does not support actionSupport, and since your actionSupport is a child of pageBlockTable, this is not going to work. It's a fluke that it works with Firefox.
If you want to leverage the onchange event for an inputField, you have to make it a child of inputField. If it's not working with iteration then maybe you should be looking at leveraging actionFunction with the onRow* attributes of pageBlockTable.