When i select 'Gold' The related data display.
Apex Class:-
------------
public class TemplateTaskData {
public TemplateTaskData(ApexPages.StandardController controller) {
lookupDataPop = new Template_Tasks__c();
//lookupDataPop = (Template_Tasks__c )controller.getrecord();
}
public Template_Tasks__c lookupDataPop {get;set;}
public string lkpdata {get;set;}
public List < Template_Tasks__c > templatetask {get;set;}
public pagereference currentData() {
system.debug('lookupDataPop.Template__c****' + lookupDataPop.Templates_Name__c);
templatetask = new list < Template_Tasks__c > ();
if (lkpdata == 'MAT-Maestro(SMB) - Gold') {
for(Integer i=0; i<5; i++){
lookupDataPop = new Template_Tasks__c();
// lookupDataPop.Templates_Name__c = lookupDataPop.Templates_Name__c;
// lookupDataPop.Billing_function__c = 'CN';
// lookupDataPop.Billing_HOURS__c = '82';
templatetask.add(lookupDataPop);
}
templatetask[0].Template_Task_Name__c = 'Maestro 5 LMS Implementation Package';
templatetask[0].Billing_HOURS__c = '82';
templatetask[0].Billing_function__c = 'CN';
templatetask[1].Template_Task_Name__c = 'Data Migration';
templatetask[1].Billing_HOURS__c = '44';
templatetask[1].Billing_function__c = 'CN';
templatetask[2].Template_Task_Name__c = 'Data migration - Express';
templatetask[2].Billing_HOURS__c = '44';
templatetask[2].Billing_function__c = 'CN';
templatetask[3].Template_Task_Name__c = 'Data Migration - Full';
templatetask[3].Billing_HOURS__c = '84';
templatetask[3].Billing_function__c = 'CN';
templatetask[4].Template_Task_Name__c = 'Maestro Full data migration X3';
templatetask[4].Billing_HOURS__c = '252';
templatetask[4].Billing_function__c = 'CN';
} else if (lkpdata == 'MAT-Maestro(SMB) - Bronze') {
for(Integer i=0; i<5; i++){
lookupDataPop = new Template_Tasks__c();
templatetask.add(lookupDataPop);
}
templatetask[0].Template_Task_Name__c = 'Maestro 5 LMS Implementation Package';
templatetask[0].Billing_HOURS__c = '44';
templatetask[0].Billing_function__c = 'CN';
templatetask[1].Template_Task_Name__c = 'Data Migration';
templatetask[1].Billing_HOURS__c = '44';
templatetask[1].Billing_function__c = 'CN';
templatetask[2].Template_Task_Name__c = 'Data migration - Express';
templatetask[2].Billing_HOURS__c = '44';
templatetask[2].Billing_function__c = 'CN';
templatetask[3].Template_Task_Name__c = 'Data Migration - Full';
templatetask[3].Billing_HOURS__c = '84';
templatetask[3].Billing_function__c = 'CN';
templatetask[4].Template_Task_Name__c = 'Maestro Full data migration X3';
templatetask[4].Billing_HOURS__c = '252';
templatetask[4].Billing_function__c = 'CN';
} else if (lkpdata == 'MAT-Maestro(SMB) - Silver') {
for(Integer i=0; i<5; i++){
lookupDataPop = new Template_Tasks__c();
templatetask.add(lookupDataPop);
}
templatetask[0].Template_Task_Name__c = 'Maestro 5 LMS Implementation Package';
templatetask[0].Billing_HOURS__c = '61';
templatetask[0].Billing_function__c = 'CN';
templatetask[1].Template_Task_Name__c = 'Data Migration';
templatetask[1].Billing_HOURS__c = '44';
templatetask[1].Billing_function__c = 'CN';
templatetask[2].Template_Task_Name__c = 'Data migration - Express';
templatetask[2].Billing_HOURS__c = '44';
templatetask[2].Billing_function__c = 'CN';
templatetask[3].Template_Task_Name__c = 'Data Migration - Full';
templatetask[3].Billing_HOURS__c = '84';
templatetask[3].Billing_function__c = 'CN';
templatetask[4].Template_Task_Name__c = 'Maestro Full data migration X3';
templatetask[4].Billing_HOURS__c = '252';
templatetask[4].Billing_function__c = 'CN';
}
return null;
}
}
VF Page:-
---------
<apex:page StandardController="Template_Tasks__c" extensions="TemplateTaskData">
<apex:Form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Template Tasks" columns="1">
<apex:inputfield value="{!lookupDataPop.Templates_Name__c}" onchange="currentDataFecth();" id="lkp">
<apex:actionFunction name="currentDatafn" action="{!currentData}" reRender="pgbsc" />
</apex:inputfield>
<apex:pageblocktable value="{!templatetask}" var="row" id="pgbsc" >
<apex:column headerValue="Template Task name" value="{!row.Template_Task_Name__c}"/>
<apex:column headerValue="Billing Function" value="{!row.Billing_Function__c}"/>
<apex:column headerValue="Billing Hours" value="{!row.Billing_hours__c}"/>
</apex:pageblocktable>
<apex:inputhidden value="{!lkpdata}" id="theHiddenInput" />
<script>
var lkpvalue='';
function currentDataFecth(){
lkpvalue =document.getElementById("{!$Component.lkp}").value;
document.getElementById("{!$Component.theHiddenInput}").value = lkpvalue ;
currentDatafn();
}
</script>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:Form>
</apex:page>