0

i am trying to create this vf page, but i don't have any idea how to do this, here VF page that i have to built-

here i have created the search function as well as how to limit the search records per page, but now i don't know how to perform copy, extend actions on that wrapper class record's those will be ticked, say

vf page code that i have created till now--

<apex:page tabStyle="Opportunity" controller="GEN_Op" >
  <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> 
  <apex:form id="frm" >

   <apex:pageBlock >
   <h1 style="text-align:center;color:red;">
    Please ensure all the rows meet the following validation rule. </h1>
    <br/><br/>
  <p></p> <h1> Single Account Opportunity</h1>   <h1> products</h1> 
  <br/>
  <h1>Submission Date Decision Date </h1>
    </apex:pageBlock>
    <apex:pageBlock >
    <h1>Single Account Opportunity:</h1>OptySync-Single Country Country CorporateFlatAccount
     <apex:pageBlockSection columns="3" >
     <apex:inputField value="{!opportunityList[0].Submission_Date__c}"/>
     <apex:inputField value="{!opportunityList[0].Decision_Date__c}"/>
     <apex:inputField value="{!opportunityList[0].CloseDate}"/>
     <apex:commandButton value="Save" action="{!save}"/>
     </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:pageBlock >
    <h1>Action:</h1>
    <br/>
    Show
    <apex:selectList value="{!selectedValue}" multiselect="false" size="1">
                <apex:selectOption itemValue="1" itemLabel="1"/>
                <apex:selectOption itemValue="2" itemLabel="2"/>
                <apex:selectOption itemValue="3" itemLabel="3"/>
                <apex:actionSupport event="onchange" action="{!search}" rerender="frm"  />
            </apex:selectList>
     records per page

    <apex:inputText value="{!searchstring}" onblur="searchAF();"/>
    <apex:actionfunction action="{!search}" rerender="frm" name="searchAF"/>
    <apex:pageBlockTable value="{!wrapProductList}" var="accWrap"   >
                    <apex:column >
                      <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                      <apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!accWrap.productObject.PricebookEntry.Name}" />
                    <apex:column value="{!accWrap.productObject.Contract_Start_Date__c}" />
                    <apex:column value="{!accWrap.productObject.Service_Start_Date__c}" />
                    <apex:column value="{!accWrap.productObject.Full_Revenue_Date__c}" />
                    </apex:pageBlockTable>
    </apex:pageBlock>
   </apex:form>

</apex:page>

Controller-

public class GEN_Op {
    public void save() {
        update opportunityList;
    }

   ID opportunId = ApexPages.currentPage().getParameters().get('id');
   public List<Opportunity> opportunityList {get;set;}
    public List<wrapProduct> wrapProductList {get; set;}

    public String selectedValue{get;set;}
    public String searchstring {get;set;}
  public GEN_Op(){ 
   opportunityList = new List<Opportunity>();
   opportunityList = [Select id, Submission_Date__c,Decision_Date__c,CloseDate from Opportunity where id =: opportunId ];
   wrapProductList = new List<wrapProduct>();
   for(OpportunityLineItem priceBookEntryObject: [SELECT PricebookEntry.Name,Contract_Start_Date__c,Service_Start_Date__c,Full_Revenue_Date__c FROM OpportunityLineItem where opportunityId =: opportunId]) {
                 wrapProductList.add(new wrapProduct(priceBookEntryObject));


   }
   }
    public void search(){  
                 wrapProductList = new List<wrapProduct>();
                 string searchquery='SELECT PricebookEntry.Name,Contract_Start_Date__c,Service_Start_Date__c,Full_Revenue_Date__c FROM OpportunityLineItem where PricebookEntry.Name like \'%'+searchstring+'%\' AND opportunityId =: opportunId Limit ' +selectedValue;  

                 for(OpportunityLineItem priceBookEntryObject: Database.query(searchquery)) {
                      wrapProductList.add(new wrapProduct(priceBookEntryObject)); //adding the searched products into list
                 }
        }

        public class wrapProduct {
                public OpportunityLineItem productObject {get; set;}
                public Boolean selected {get; set;}

                public wrapProduct(OpportunityLineItem pBEParam) {
                    productObject = pBEParam;
                    selected = false;
                }
        }



}
  • onclick of checkbox you want to get that selected record in Controller ? – Ratan Paul Feb 16 '16 at 7:05
  • Extend 1. Can extend selected product’s dates by days entered. – RAT__ Feb 16 '16 at 7:09
  • actually here first i'll be choosing which records date to be updated for that i'll be ticking the checkbox then i'll go for extend where i''l tick check box and i''l put no. of days to be extended in that date inside the record which was ticked at the starting – RAT__ Feb 16 '16 at 7:11
  • on click of radio button i want to update dates according to no. of days entered – RAT__ Feb 16 '16 at 7:12
  • RAT__ So when you click on row check box then assign that record id to controller variable check this ans how to assign Id to controller variable salesforce.stackexchange.com/a/110393/18731 and then when you click onabove check box call a controller method and check which record was selected before and based on that update dates accordingly – Ratan Paul Feb 16 '16 at 7:14

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.