function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
naresh.sfdc1.3885733215764783E12naresh.sfdc1.3885733215764783E12 

How can i create a page in site.com to search data daynamically and display it in table?

How can i create a page in site.com to search data daynamically and display it in table?

For this i have try salesforce ajax toolkit on site.com's custom  page and use vf-page in site.com page using <iframe> tag also. Both are not working even apex class functionality is also not working on vf page in site.com.

And i wanted to use chatter also on site.com's page, getting stuck here also. How can i do this?
Vinita_SFDCVinita_SFDC
Hello,

Out of the box search is not currently supported. You can implement search functionality based on a single field in your Salesfroce object.

1. You can add a click event on Search button which would open a new page and pass the query string as parameter in url.
2. Add a repeater on searh results page which uses filter as-
                Field:<Your Field>
                Operator: Contains
                Source: URL query string
This would work for a single field search only.
Chandra PrakashChandra Prakash
Hi Naresh,

Please try this below code

Step 1:  Firstly create Apex code for search data.
public with sharing class accsearchvalue {
   public list <account> acc {get;set;}
   public string searchstring {get;set;}
   public accsearchvalue(ApexPages.StandardController controller) {
   }
   public void search(){
     string searchquery='select name,id from account where name like \'%'+searchstring+'%\' Limit 20';
     acc= Database.query(searchquery);
   }
   public void clear(){
   acc.clear();
   }
}

Step 2 : Then create VisualForce page . you can see below.
<apex:page standardController="account" extensions="accsearchvalue">
  <apex:form >
<apex:inputText value="{!searchstring}" label="Input"/> 
  <apex:commandButton value="Search records" action="{!search}"/>
  <apex:commandButton value="Clear records" action="{!search}"/>
   <apex:pageBlock title="Search Result">
    <apex:pageblockTable value="{!acc}" var="a">
     <apex:column >
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.Name}</apex:outputlink>
     </apex:column>
     <apex:column value="{!a.id}"/>
    </apex:pageBlockTable>   
   </apex:pageBlock> 
  </apex:form>
</apex:page>

Step 3 : Then go to Setup > Develop > Sites, Click on New button for add new site .

User-added image


Regards,
Chandra Prakash Sharma
Bisp Solution Inc.
http://bisptrainings.com