When i click on any row using onrowclick function in apex:pageBlockTable. I am able to select the row using javascript functionality but i am not able to get the selected row data to row data in alert box.
Can any one help me How to get selected row data in controller?
Please find the vfpage and controller
<apex:page controller="petwizardcontroller" sidebar="false">
<apex:form title="">
Household Name: <apex:inputText value="{!ID_c}" />
<apex:commandButton value="Search" action="{!doSearch}"/>
<apex:pageBlock >
<apex:pageblockTable value="{!lstQuery}" var="eachRecord">
<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:selectList value="{!eachRecord.Phone__c}">
<apex:selectOptions value="{!eachRecord.of_Childrens__c}">
</apex:selectOptions>
</apex:selectList>
</apex:pageblockTable>
<apex:commandButton value="None of These" reRender="PCSHouseTable"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller
public class petwizardcontroller {
public string ID_c{get;set;}
public List<PCS_Household__c> lstQuery{get;set;}
public petwizardcontroller(){
lstQuery=new List<PCS_Household__c>();
}
public Void doSearch(){
string Query='';
Query='SELECT Name,Household__c,Phone__c,of_Childrens__c,of_Exiting_Pets__c,Address__c FROM PCS_Household__c where Household__c LIKE \'%'+ID_c+'%\'';
system.debug('==Query=='+Query);
lstQuery=Database.query(Query);
system.debug('==lstQuery=='+lstQuery);
}
}