1

when i click on the column action event working when i open the log coming with null value... values are not displaying in the table.

<apex:page controller="actionSupportController">
<apex:form >        
            Household Name: <apex:inputText value="{!ID_c}" />
    <apex:commandButton value="Search" action="{!doSearch}" rerender="pblck"/>

   <apex:pageBlock id="pblck" >
    <apex:pageblockTable value="{!lstQuery}" var="eachRecord" >
        <apex:column ><apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="out">
        <apex:param value="{!eachRecord.ID}" assignTo="{!test}"/>
        </apex:actionSupport></apex:column>
        <apex:column value="{!eachRecord.ID}"/>
        <apex:column value="{!eachRecord.Household__c}"/>
        <apex:column value="{!eachRecord.Name}"/>
        <apex:column value="{!eachRecord.Phone__c}"/>
        <apex:column value="{!eachRecord.of_Childrens__c}"/>
        <apex:column value="{!eachRecord.of_Exiting_Pets__c}"/>
        <apex:column value="{!eachRecord.Address__c}"/>
        <apex:column value="{!eachRecord.Previous_Dog__c}"/>
    </apex:pageblockTable>
   </apex:pageBlock>

    <apex:pageBlock id="out">
    <apex:pageBlockTable value="{!OnlstQuery}" var="eachReco">
        <apex:column value="{!eachReco.ID}"/>
        <apex:column value="{!eachReco.Household__c}"/>
        <apex:column value="{!eachReco.Name}"/>
        <apex:column value="{!eachReco.Phone__c}"/>
        <apex:column value="{!eachReco.of_Childrens__c}"/>
        <apex:column value="{!eachReco.of_Exiting_Pets__c}"/>
        <apex:column value="{!eachReco.Address__c}"/>
        <apex:column value="{!eachReco.Previous_Dog__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>

         <!--<apex:outputpanel id="panel1" >
                <apex:outputText value="Click here to increment!"/>
                <apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="out"/>                   
            </apex:outputpanel>

             <apex:outputpanel id="panel2">
                <apex:outputText value="Click here to decrement!"/>
                <apex:actionSupport event="onclick" action="{!decrementCounter}" rerender="out"/>
            </apex:outputpanel>

            <apex:outputText value="{!Query}" id="out" label="Count Is:"/>-->
  </apex:form>
</apex:page>

Controller

public class actionSupportController {
public List<PCS_Household__c> lstQuery{get;set;} 
public List<PCS_Household__c> OnlstQuery{get;set;}
public string ID_c{get;set;}      
public string test{get;set;} 

public PageReference incrementCounter() {
   string Query='';
    Query='SELECT ID,Name,Household__c,Phone__c,of_Childrens__c,of_Exiting_Pets__c,Address__c,Previous_Dog__c FROM PCS_Household__c where ID=:test' ;
    system.debug('==Query=='+Query);
    OnlstQuery=Database.query(Query);
    system.debug('==lstQuery=='+OnlstQuery);
    return null;
}

 public Void doSearch(){
    string Query='';
    Query='SELECT ID,Name,Household__c,Phone__c,of_Childrens__c,of_Exiting_Pets__c,Address__c,Previous_Dog__c FROM PCS_Household__c where Household__c LIKE \'%'+ID_c+'%\'';
    system.debug('==Query=='+Query);
    lstQuery=Database.query(Query);
    system.debug('==lstQuery=='+lstQuery);
 }

}

1 Answer 1

0

Issue with apex:param you need to give any name to your param

<apex:param name="recordId" value="{!eachRecord.ID}" assignTo="{!test}"/>

This should work now. without name it will not work..

Let me know if this resolved your issue or not.

4
  • 1
    you are awesome.. code works fine. but only 1 time on click working ?
    – muralimano
    Commented May 19, 2016 at 5:15
  • @muralimano what do you mean by 1 time on click working? you want to say it is working for only one time. If i click on first column for multiple times it will not work ? is it ?
    – Ratan Paul
    Commented May 19, 2016 at 5:17
  • hi @Ratan i want to get this value in inputfield. could you please help me
    – muralimano
    Commented May 19, 2016 at 6:59
  • @muralimano can you please ask a new question with your new issue and let us know what you have tried so far. This way i could help you more
    – Ratan Paul
    Commented May 19, 2016 at 7:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .