I am trying to have a jquery slideToggle() function bound to a row of data in an apex:pageBlockTable.
I am displaying some information in the table and want that if someone clicks on any row, some more information related to that contact is displayed in a slider and the rest of the rows move down. When he clicks again, the slider moves up and everything is back to normal.
If I am not wrong, I think I need to bind row elements (apex:columns) in one div and the information in the slider in the other. But somehow this is not working.
Here is the code:
<apex:page controller="xingShowSearchResult">
<head>
<style type="text/css">
#rowInfo,#rows{
padding:5px;
text-align:center;
background-color:#e5eecc;
border:solid 1px #c3c3c3;
}
#rowInfo {
width:50px;
display:none;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$j = jQuery.noConflict();
$j(document).ready(function(){
$j("#rows").click(function(){
$j("#rowInfo").slideToggle("slow");
});
});
</script>
</head>
<body>
<apex:pageMessages />
<div id='backtoDiv' style="height:20px;">
<apex:outputLink value="/apex/XingPageTab" style="color:blue;">Back to Home Page</apex:outputLink>
</div>
<apex:pageBlock title="Suche Kontakte">
<apex:pageBlockSection columns="1">
<apex:form style="float:right" >
<apex:commandLink style="height:20px;font-weight: bold;" value="Suchergebnisse entfernen" action="{!deleteSearchResult}" />
</apex:form>
</apex:pageBlockSection>
<apex:pageBlockTable value="{!newList}" var="contacts" id="contactsTable">
<div id="rows">
<apex:column >
<apex:image url="{!contacts.photoURL__c}" />
</apex:column>
<apex:column headerValue="Name"> {!contacts.displayName__c}</apex:column>
<apex:column headerValue="Firma"> {!contacts.firma__c}</apex:column>
<apex:column headerValue="Title" > {!contacts.title__c}</apex:column>
</div>
<div id="rowInfo" >
<p>
This is the paragraph to end all paragraphs. You
should feel <em>lucky</em> to have seen such a paragraph in
your life. Congratulations!
</p>
</div>
</apex:pageBlockTable>
</apex:pageBlock>
</body>
</apex:page>
I am trying to understand Visualforce and JS so any help would be appreciated.
Best, Ankit