Tuesday, November 29, 2016

actionStatus Tag in Visualforce

This tag helps Us to display the status AJAX request like an AJAX request can either be in progress or Complete.

Below Visualforce helps you to search opportunity based on name:






Page:

<apex:page controller="OppsearchController">
<apex:form >
    <apex:pageBlock id="pb" mode="edit">
        <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
                <apex:outputLabel for="Search String">Search String</apex:outputLabel>
                <apex:panelGroup >
                    <apex:inputText value="{!searchString}"/>
                    <apex:commandButton value="GO" action="{!oppResult}" status="as" reRender="pbt"/>
                    <apex:actionStatus startText="Searching……." id="as"></apex:actionStatus>
                </apex:panelGroup>
              </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        <apex:pageBlockSection title="Result">
            <apex:pageBlockTable value="{!OppSearchResult}" var="opp" id="pbt">
            <apex:column value="{!opp.name}"/>
        </apex:pageBlockTable>
       </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

Controller:


public class OppsearchController {
    List<Opportunity> OppSearchResult;
    public String searchString { get; set; }
    public List<Opportunity> getOppSearchResult() {
        return OppSearchResult;
    }
    public PageReference oppResult() {
        OppSearchResult = (List<Opportunity>)[FIND :searchString RETURNING
        Opportunity(Name)][0];
        return null;
    }
}


No comments:

Post a Comment