I have a Visualforce page with a page block table which contains multiple rows based on the search result from sosl query.Now I need to select multiple rows using checkbox and on button click need to pass the id's of selected rows to create pdf of those records. the pdf i am getting is blank. Please help. thanks in advance


    public class TEST_soslQueryPageBlock {

      public string searchText {get;set;}

    public list<list<sObject>> soslResults {
        get {
            if(searchText != null && searchText != '') {
                soslResults = [FIND :searchText IN ALL FIELDS RETURNING  lead(Id,name, email), Contact(Id,name, email), Account(Id,name, phone)];
            return soslResults;

    public class searchResultRow{
        public string sObjectTypeName {get;set;}
        public sObject record {get;set;}
        public Boolean isSelected{get;set;}

        public searchResultRow(sObject pObject) {
            record = pObject;
            sObjectTypeName = pObject.getSObjectType().getDescribe().getLabel();

    public list<searchResultRow> searchResults {
        get {
            searchResults = new list<searchResultRow>();
            Boolean isSelected=false;
            if(soslResults != null) {

                for(list<sObject> objectList : soslResults) {
                    for(sObject obj : objectList) {
                        searchResults.add( new searchResultRow(obj));

            return searchResults;

    public PageReference  generate()
        PageReference pg;
        pg = Page.PdfTest;
        return pg;

Vf page for pdf

<apex:page controller="TEST_soslQueryPageBlock">
    <apex:repeat value="{!searchResults}" var="a">
        <apex:outputPanel rendered="{!a.isSelected}">

Vf for search query

            <apex:inputText id="searchParam" value="{!searchText}"/>
    <apex:pageBlockSection title="Results" rendered="{!searchResults.size > 0}">
        <apex:pageBlockTable value="{!searchResults}" var="row">
            <apex:column >
                <apex:facet name="header">
                <apex:inputCheckbox onclick="cvCheckAllOrNone(this,'inputId')"/>   
                <apex:inputCheckbox value="{!row.isSelected}"/>
            <apex:column value="{!row.record['Name']}"  />
            <apex:column value="{!row.sObjectTypeName}" headerValue="Type" />       
      <apex:commandButton value="Generate PDF" action="{!generate}"/> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.