+ Start a Discussion
raju.Braju.B 

How to get the ID of a record in mouse over.

Hi,

 

 

I displayed all accounts in visualforce page..

 

when i click on a particular account a displayed contact details under that account..

 

by geting the id of the record like this:

 

ApexPages.currentPage().getParameters().get('id');

 

 

but i need to display contact details of an account when ever i place a mouse on a particular account.

 

how to get the ID of  a particukar record when mouseover occurs on that record.

 

 

Thanks,

 

Sirisha.k

 

 

rahul_123rahul_123

take reference from this code.................this will show contact detail on mouse over

 

but use account id in url too

 

 

 

<apex:page standardController="Account">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying contacts from the {!account.name} account.
Mouse over a contact's name to view his or her details.
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:form >
<apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4"
border="1">
<apex:column >
<apex:outputPanel >
<apex:actionSupport event="onmouseover" rerender="detail">
<apex:param name="cid" value="{!contact.id}"/>
</apex:actionSupport>
{!contact.Name}
</apex:outputPanel>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:actionStatus startText="Requesting...">
<apex:facet name="stop">
<apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false"
title="false"/>
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>

 

 

 

mark as solution if ur query got solved so that others can benefit

 

thanks

raju.Braju.B

Hi,

 

Thanks for the reply.

 

But im working with a custom objects..

 

So i need a controller for that..

 

can you please help me ..????

 

Thanks,


Sirisha.k

rahul_123rahul_123

do u have the code and are u using custom controller........ and try to understand that code......

u can do that once u understand it

raju.Braju.B

 

 

 

public class related
{
set<id> mset=new set<id>();
list<message__c> mlist=new list<message__c>();
list<registration__c> rlist=new list<registration__c>();
public boolean re{set;get;}
public boolean re1{set;get;}
public  related()
{
re=false;
re1=true;
for(message__c m:[select name,id from message__c])
{
mlist.add(m);
}
}
public void view()
{
re=true;
re1=false;
String eid=apexpages.currentPage().getParameters().get('pid');
for(message__c m1:[select id,name from message__c where id=:eid])
{
mset.add(m1.id);
}
for(registration__c r:[select name,lastname__c,email__c from registration__c where message__c in:mset])
rlist.add(r);
}
public list<message__c> getdata()
{
return mlist;
}
public list<registration__c> getrdetails()
{
return rlist;
}
public void back()
{
re1=true;
re=false;
}
}

 

 

 

<apex:page controller="related">

<apex:form >

<apex:pageBlock >

<apex:outputPanel rendered="{!re1}">

<apex:pageBlockTable value="{!data}" var="item">

 

  <apex:column headerValue="name">

  <apex:commandLink value="{!item.name}">

  <apex:actionSupport event="onmouseover" rerender="detail" action="{!view}"> 

                              <apex:param name="pid" value="{!item.id}"/>

                          </apex:actionSupport> 

                          </apex:commandLink>

                          </apex:column>

  <!--<apex:commandLink value="{!item.name}" action="{!view}">-->

 

 

 

 

 

 

 

 

 

  </apex:pageBlockTable>

  </apex:outputPanel>

 

  <apex:outputPanel >

 

 

  <!--<apex:commandButton value="back" action="{!back}"/>-->

  <apex:pageBlockTable value="{!rdetails}" var="e" id="detail">

  <apex:column headervalue="name" value="{!e.name}"/>

  <apex:column headervalue="lastname" value="{!e.lastname__c}"/>

  <apex:column headervalue="email" value="{!e.Email__c}"/>

  </apex:pageBlockTable>

  </apex:outputPanel>

 

</apex:pageBlock>

</apex:form>

 

</apex:page>

 

public class related{set<id> mset=new set<id>();list<message__c> mlist=new list<message__c>();list<registration__c> rlist=new list<registration__c>();public boolean re{set;get;}public boolean re1{set;get;}public  related(){re=false;re1=true;for(message__c m:[select name,id from message__c]){mlist.add(m);}}public void view(){re=true;re1=false;String eid=apexpages.currentPage().getParameters().get('pid');for(message__c m1:[select id,name from message__c where id=:eid]){mset.add(m1.id);}for(registration__c r:[select name,lastname__c,email__c from registration__c where message__c in:mset])rlist.add(r);}public list<message__c> getdata(){return mlist;}public list<registration__c> getrdetails(){return rlist;}public void back(){re1=true;re=false;}}

raju.Braju.B

Hi,

Actually im new to salesforce...

 

above one is my page and controller..

 

Can you please tell me where shoul i call mouse over in VF page?

 

 

Thanks,

 

Sirisha.k