Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public with sharing class AccountSearchController {
- public String searchText {get; set;}
- public List<Account> accList{get; set;}
- public PageReference doSearch(){
- List<List<sobject>> records =[FIND :searchText
- RETURNING Account(Name, Site, Rating)];
- accList = records[0];
- return null;
- }
- }
- <apex:component controller="AccountSearchController">
- <apex:form >
- <apex:pageBlock title="Account Search Page">
- <apex:pageBlockSection title="Search String">
- <apex:inputText label="Search Text" value="{!searchText}"/>
- <apex:commandButton value="Search" action="{!doSearch}" reRender="rs"/>
- </apex:pageBlockSection>
- <apex:pageBlockSection title="Search Result" id="rs">
- <apex:pageBlockTable value="{!accList}" var="acc">
- <apex:column value="{! acc.Name}"/>
- <apex:column value="{! acc.Site}"/>
- <apex:column value="{! acc.Rating}" />
- </apex:pageBlockTable>
- </apex:pageBlockSection>
- </apex:pageBlock>
- </apex:form>
- </apex:component>
Add Comment
Please, Sign In to add comment