[SalesForce] get data when click on row in pageBlockTable

I have a pop-up display a table with some columns (Name, ID) of Accounts for example, I want to display additional information of the selected account when I click on specific row.

I used something like this, but I must click on a column not row , and does not get the correct data.

<apex:actionFunction name="readCell" action="{!readCellMethod}">
        <apex:param name="rowID" value="" assignTo="{!clickedRowId}"/>
</apex:actionFunction>

<apex:pageBlockTable value="{!account}" var="acc">                                    
   <apex:column headerValue="ID" value="{!acc.Id}" />
   <apex:column headerValue="Name" value="{!acc.Name}" onclick="readCell('{!acc.Id}')"/>
</apex:pageBlockTable>

Best Answer

Here's an option that still keeps your pageBlockTable. Add your jquery resource or link to it. Then, add this to head...

<apex:includeScript value="{!URLFOR($Resource.jQuery, '/js/jquery-1.4.2.min.js')}"  />
<script type="text/javascript">
    $j = jQuery.noConflict();
    function clickElem(elem){
        alert($j(elem).find(".accId").html());
    }
</script>

Add the onRowClick to the pageBlockTable and add a styleClass to your column.

<apex:pageBlockTable value="{!account}" var="acc" onRowClick="clickElem(this);">                                    
   <apex:column headerValue="ID" value="{!acc.Id}" styleClass="accId" />
   <apex:column headerValue="Name" value="{!acc.Name}" />
</apex:pageBlockTable>

Woo-hoo! First post on stackexchange...