+ Start a Discussion
vipin indoravipin indora 

list not accessible from different one component to another component. searching is not working?

this is paginationComponent

<apex:component controller="contactcloudcontroller" >
  <apex:form id="pgBlock">
 <apex:pageBlock >
 <apex:actionFunction action="{!search}" name="callFunc{!paginations}"/>
 <style> 
     #t:hover{
                background-color: #87cefa;
                cursor: pointer;
            }
   </style> 
    <table width="100%" style="font-size: 12pt; border: 1pt solid black;">
        <tr bgcolor="#87cefa">
            <th>First Name</th>
            <th>Last Name</th>
            <th>Email</th>
            <th>Phone</th>
            <th>State</th>
            <th>City</th>
        </tr>
          <apex:repeat value="{!clist}"  var="cont">
            <tr id="t">
                  <td><apex:outputText value="{!cont.firstname}" /></td>
                  <td><apex:outputText value="{!cont.lastname}"/></td>
                  <td><apex:outputText value="{!cont.email}"/></td>
                  <td><apex:outputText value="{!cont.phone}" /></td>
                  <td><apex:outputText value="{!cont.mailingstate}"/></td>
                  <td><apex:outputText value="{!cont.mailingCity}"/></td>
             </tr>
        </apex:repeat>
    </table>
    
     <apex:pageblockButtons >
        <apex:commandButton value="First Page" rerender="pgBlock" action="{!FirstPage}" disabled="{!prev}" immediate="true"/>
        <apex:commandButton value="Previous" action="{!Previous}" immediate="true" rerender="pgBlock" disabled="{!prev}" />
        <apex:commandButton value="Next" action="{!Next}" immediate="true" rerender="pgBlock" disabled="{!nxt}"/>
        <apex:commandButton value="Last Page" rerender="pgBlock" action="{!LastPage}" disabled="{!nxt}" immediate="true"/>
        
   </apex:pageblockButtons>
   </apex:pageBlock> 
</apex:form>
</apex:component>

 

this is searchComponent

<apex:component controller="contactcloudcontroller" allowDML="true">
 <apex:form id="pgBlock">
  <apex:pageMessages />
  
  <apex:pageBlock >
      <apex:pageBlockSection columns="2" collapsible="true">
          <apex:inputField value="{!con.firstname}"/>
          <apex:inputField value="{!con.lastname}" required="false"/>
          <apex:inputField value="{!con.email}"/>
          <apex:inputField value="{!con.phone}"/>
          <apex:inputField value="{!con.MailingState}"/>
          <apex:inputField value="{!con.MailingCity}"/>
          <apex:inputField value="{!con.Accountid}"/>
      </apex:pageBlockSection>
      
      <apex:commandButton value="save" action="{!save}"/>
      <apex:commandButton value="search" action="{!search}" reRender="pgBlock"/>
      
   </apex:pageBlock>
   
  </apex:form>
</apex:component>

 

this is my page

<apex:page controller="contactcloudcontroller" showHeader="true" tabStyle="contact">
  <c:searchComponent />
  <c:paginationComponent />
</apex:page>

James LoghryJames Loghry
Components are modular and separate from one another.  In order to get them to talk to one another, you'll need to pass in parameters using the apex:attribute tag (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_attribute.htm)  Furthermore, the following line is likely causing issues too:
 
<apex:actionFunction action="{!search}" name="callFunc{!paginations}"/>

Remove the {!paginations} text from the name attribute and pass in paginations through an apex:parameter instead:
 
<apex:actionFunction action="{!search}" name="callFunc">
        <apex:param name="paginations" value="{!paginations}"/>
    </apex:actionFunction>

You'll then need to tie paginations to a member variable in your controller.

I doubt this will fix your issue completely, but should point you on the right track.

Also, please use the code format button (< >) when posting any code, Visualforce markup, or SOQL queries in the future.  Thanks!