When I press view link, the record page must open and it is not opening. Another one is and it is showing both search records and list of all records.
<apex:page standardController="Documents__c" extensions="Documentlist3,Documentsearch" recordSetVar="Member" showHeader="false" sidebar="false">
<apex:form >
<apex:pageBlock mode="edit" id="block">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for="searchText">Search Text</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Go!" action="{!doSearch}" rerender="block" status="status"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">
<apex:column value="{!l.Name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockTable value="{!DocList}" var="D">
<apex:column value="{!D.Name}"/>
<apex:column value="{!D.Description__c}"/>
<apex:column >
<apex:commandLink value="View" action="{!viewcase}">
<apex:param name="Doclist" value="{!D.Id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
EXT1:
public class Documentlist3 {
public Documents__c abcx{ get; set; }
public List<Documents__c> DocList {get;set;}
private ApexPages.StandardSetController standardController;
private Set<Id> DocIds = new Set<Id>();
public Documentlist3(ApexPages.StandardSetController standardController){
this.standardController = standardController;
DocList = new List<Documents__c>();
for (Documents__c Doc : (List<Documents__c>)standardController.getSelected()){
DocIds.add(Doc.Id);
}
DocList = [SELECT Id,Name,Description__c FROM Documents__c];
}
public Account viewcase() {
return [SELECT Id, Name FROM Account
WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];
}
}
EXT2:
public class Documentsearch {
public Documentsearch(ApexPages.StandardSetController controller) {
}
String searchText;
List<Documents__c> results;
public String getSearchText() {
return searchText;
}
public void setSearchText(String s) {
searchText = s;
}
public List<Documents__c> getResults() {
return results;
}
public PageReference doSearch() {
results = (List<Documents__c>)[FIND :searchText RETURNING Documents__c(Name),Documents__c(Name)][0];
return null;
}
}
I have 2 issues in this when
- When i am clicking the view button the record is not opening and
- When i am searching i am getting searching values separatley
I want if I search, the search results must show. Otherwise the document list must come. Please anyone solve this and help me