• Anil Kumar 1633
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
<apex:component Controller="PaginationCompController"  allowDML="true">
    <apex:attribute name="fObject" type="String" description="Any Object" assignTo="{!selectedObject}" />
    <apex:attribute name="fFieldsList" type="String[]" description="List of Fields" assignTo="{!selectedFields}"/>  
       
    <apex:form id="Records_View">
      <script type="text/javascript">
            function selectAllCheckboxes(obj,receivedInputID){
                var inputCheckBox = document.getElementsByTagName("input");
                for(var i=0; i<inputCheckBox.length; i++){
                    if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                        inputCheckBox[i].checked = obj.checked;
                    }
                }
        }
        </script>
        <!-- ========================== Invoking the show method automatically by using JS     ===================    -->
        <apex:actionFunction name="invokeShowMethodOfCompoCon" action="{!show}" reRender="Records_View,recPage" />
       
        
        
        <!-- ===================================  PAGE BLOCK FOR THE RECORDS ======================================== -->
        <apex:pageBlock id="recPage" rendered="{!hFields}"  >  
            <apex:pageMessages ></apex:pageMessages>
            <!--  Panel for Buttons  -->
            <div align = "left">  
                    <table>
                        <tr>
                            <td>
                                 <apex:commandButton value="New Record"  reRender="recPage" action="{!URLFOR($Action[SelectedObject].New)}"/>   
                            </td>
                            <td>
                                <apex:commandButton value="Delete Selected"  action="{!deleteSelectedRecords}" reRender="recPage">
                                </apex:commandButton>
                            </td>
                            <td>    
                                <apex:commandButton value="Downlaod CSV" action="{!downloadCsv}" reRender="ff"  />
                            </td>
                        </tr>
                    </table>
            </div>
            
            <!-- Panel For Alphabetical Sorting         -->
            <div align="right">
                <apex:panelGrid >
                    <apex:repeat value="{!alphabetList}" var="alph">
                        <apex:commandLink value="{!alph} | " action="{!sortByAlphabets}" reRender="recPage" status="spinnerStatus" >
                            <apex:param value="{!alph}" name="Alphabet" assignTo="{!alphaToBeSearch}"/>   
                        </apex:commandLink>
                    </apex:repeat>
                </apex:panelGrid>
            </div>  
            
            <apex:pageBlocktable value="{!listOfWrapper}" var="rec">
                <!-- Add the CheckBoxes before the Actions links -->
                <apex:column width="20px">
                    <apex:facet name="header">
                        <!--   Master CheckBox  -->
                        <apex:inputcheckbox value="{!rec.isSelected}"  onclick="selectAllCheckboxes(this,'inputId')"/>
                    </apex:facet>
                    <!--  CheckBox for the Each Record    -->
                    <apex:inputcheckbox value="{!rec.isSelected}" id="inputId" />
                </apex:column>
                <!--  Adding Header for the same column i.e(Action) by using facet  -->
                <apex:column style="width:60px">
                    <apex:facet name="header">
                        <apex:outputText > Action </apex:outputText>
                    </apex:facet>
                    <apex:outputLink value="/{!rec.obj.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold;text-decoration:none;color:#0645AD;">
                        Edit |&nbsp;
                    </apex:outputLink>
                    <apex:commandLink action="{!deleteAccount}" onclick="if(!confirm('Are you sure?')) return false;" style="font-weight:bold;text-decoration:none;color:#0645AD;">
                        Del
                        <apex:param value="{!rec.obj.id}" assignTo="{!recId}" name="recId"/>
                    </apex:commandLink>
                    
                </apex:column>   
                <apex:repeat value="{!selectedFields}" var="itr"  >
                    <apex:column value="{!rec.obj[itr]}">
                        <apex:facet name="header">
                            <apex:commandLink action="{!sortByColumn}" reRender="recPage,ee" value=" {!$ObjectType[selectedObject].fields[itr].label} {!IF(sortDir=='desc','↓','↑')}" id="ee" status="spinnerStatus">  
                                <apex:param name="column" value="{!itr}" assignTo="{!sortingValues}"/>
                            </apex:commandLink>
                        </apex:facet>
                    </apex:column>
                </apex:repeat>                    
            </apex:pageBlocktable>
                           
            <!-- Pagination -->
            <table style="width: 100%">
                <tr>
                    <!-- Page X of Y -->
                    <td>
                        <!-- Dropdown for the to visible the records -->
                        <apex:selectList value="{!Size}" size="1" >
                            <apex:selectOption itemValue="5" itemLabel="5"/>
                            <apex:selectOption itemValue="10" itemLabel="10"/>
                            <apex:selectOption itemValue="15" itemLabel="15"/>
                            <apex:selectOption itemValue="20" itemLabel="20"/>
                            <apex:actionSupport event="onchange" action="{!pageSize}" reRender="recPage"  />
                        </apex:selectList>
                    </td>
                    <td align="center">
                        <!--First Button-->
                        <apex:commandButton action="{!first}" value="First" disabled="{!!ssc.hasPrevious}" reRender="recPage" status="spinnerStatus"/>
                        <!--Previous Button-->
                        <apex:commandButton action="{!previous}" value="Previous" disabled="{!!ssc.hasPrevious}" reRender="recPage" status="spinnerStatus" />
                        <!--Next Button-->
                        <apex:commandButton action="{!next}" value="Next" disabled="{!!ssc.hasNext}" reRender="recPage" status="spinnerStatus"/>
                        
                        <!--Last Button-->
                        <apex:commandButton action="{!last}" value="Last" disabled="{!!ssc.hasnext}" reRender="recPage" status="spinnerStatus"/>
                    </td>
                    <td align="right">
                        <!--====================================        Records per page -----------------  Jumping to the Page Number by Entering any number          =                        -->
                        
                        Page:
                        <apex:inputText value="{!pageNumber}" size="1">
                            <apex:actionSupport event="onblur" action="{!finalPageNumber}" reRender="recPage" />
                        </apex:inputText>
                        <apex:outputText value=" {! ssc.PageNumber} of {! CEILING(ssc.ResultSize / ssc.PageSize) }"/>
                        
                    </td>
                </tr>
            </table>
        </apex:pageBlock>
    </apex:form>
</apex:component>


Controller::



  public string renderAsExcel{get;set;}
    Public Boolean pb{get;set;}
    public Pagereference downloadCsv(){
        System.debug('we are Inside the Download CSV');
        recordsInWrapper();
        System.debug('The wrapper list is ' + listOfWrapper);
        pb=true;
        renderAsExcel='application/vnd.ms-excel#Account Report.csv';
        System.debug('The value of render as Excecl is ' + renderAsExcel);
        return null;
    }    
   

 
Hi,
Here i need to pass values from One VF page to another VF page.
In one vf page i have selected some records or values and then i want to pass those values to another page.
So please help me..
Thanks in Advance.
Anji