Skip to main content
abc def が「#Visualforce」で質問
option to open detail page of the records returned in search.

this is my vf page

<apex:page showChat="false" sidebar="false" controller="book4">

<apex:form >

  <apex:pageblock >

   <apex:pageblockButtons location="top" >

          <apex:commandButton value="search" action="{!search}"/>

          </apex:pageblockButtons>

         <apex:pageBlockSection title="book">

         <apex:inputText value="{!N1}"/>

         <apex:pageBlockTable var="a" value="{!Bk1}">

          <apex:column value="{!a.name}"/ >

          

          </apex:pageBlockTable>

          </apex:pageBlockSection>

      </apex:pageblock>

   </apex:form>

  </apex:page>

and this is my controller

public with sharing class book4 {

    public  list<Book__c> Bk1 { get; set; }

 public String N1 {get;set;}

 

  public book4() {

  

  Bk1 = new list<Book__c>();

  }

  

  public void search(){

  

    

     Bk1 = [select Name from Book__c where Name LIKE:('%'+N1+'%')];

    

    

    }

}
2 件の回答
  1. 2018年5月3日 5:37
    Hi Divya,

    Modify your VF page as below.

     

    <apex:page showChat="false" sidebar="false" controller="book4">

    <apex:form >

    <apex:pageblock >

    <apex:pageblockButtons location="top" >

    <apex:commandButton value="search" action="{!search}"/>

    </apex:pageblockButtons>

    <apex:pageBlockSection title="book">

    <apex:inputText value="{!N1}"/>

    <apex:pageBlockTable var="a" value="{!Bk1}">

      <apex:column headerValue="Account hyperlink">

      <apex:outputlink value="/{!a.Id}">{!a.Name}

      </apex:outputlink>

      </apex:column>

    <apex:column value="{!a.name}"/>

    </apex:pageBlockTable>

    </apex:pageBlockSection>

    </apex:pageblock>

    </apex:form>

    </apex:page>

    You can change header name as per your requirement.

    Kindly mark this answer as best answer if it helps you.

    Regards,

    Sagar
0/9000