You need to sign in to do that
Don't have an account?
morley
onClick event failing
Hi there ... this one is baffling me. I have onClick events defined in two places, but only one will work. When I click on a record from the first table (Account Types), the onClick works fine. But if I click on a record from the second table (Accounts), the event doesn't fire. Why??
PAGE:
CONTROLLER:
PAGE:
<apex:page controller="commsActivity" id="thePage"> <apex:pageBlock> <apex:outputPanel id="myAccountTypes"> <apex:form> <apex:dataTable value="{!account_types}" var="thisAccountType" id="theAccountTypeTable" styleClass="tableClass"> <apex:column> <apex:outputPanel> <apex:actionSupport event="onclick" reRender="myAccounts"> <apex:param name="accType" value="{!thisAccountType.Name}"/> </apex:actionSupport> {!thisAccountType.Name} </apex:outputPanel> </apex:column> </apex:dataTable> </apex:form> </apex:outputPanel> </apex:pageBlock> <apex:pageBlock> <apex:outputPanel id="myAccounts"> <apex:form> <apex:dataTable value="{!accounts}" var="thisAccount" id="theAccountTable" styleClass="tableClass"> <apex:column> <apex:outputPanel> <apex:actionSupport event="onclick" reRender="myContacts"> <apex:param name="accID" value="{!thisAccount.ID}"/> </apex:actionSupport> {!thisAccount.name} </apex:outputPanel> </apex:column> </apex:dataTable> </apex:form> </apex:outputPanel> </apex:pageBlock> <apex:pageBlock> <apex:outputPanel id="myContacts"> <apex:dataTable value="{!contacts}" var="thisContact" id="theContactTable" styleClass="tableClass"> <apex:column> {!thisContact.name} </apex:column> </apex:dataTable> </apex:outputPanel> </apex:pageBlock> </apex:page>
CONTROLLER:
public class commsActivity{ public List<System.Account_Type__c> getAccount_Types() { return [select name from account_type__c]; } public List<System.Account> getAccounts() { return [select id, name, Account_Type__c, description from account where Account_Type__c =:System.currentPageReference().getParameters().get('accType')]; } public List<System.Contact> getContacts() { return [select id, name, email from contact where Accountid =:System.currentPageReference().getParameters().get('accID')]; } }
thanks.
Glenn.