I'm very noob with apex and VF. My problem is:
I've a pageBlockTable that shows a list of record from a Custom Object. Now I've a column of the table on which there's a button ("Clone") that should perform a clone action so that If I push the button the system should clone the record of the row for which I push the button and should take me to edit page for the new cloned record .
I'm going crazy with this!
Class:
public virtual class QuotationController {
public Quotation__c myq {get; set;}
public QuotationController () {
}
public List<Quotation__c> getListaQuotation() {
return [select Id, Name, Q_Product_Consultant_costs__c, Q_Product_Program_Director_costs__c, Q_Products_total_costs__c,
Q_Product_Project_Manager_costs__C, Q_Product_Senior_Graphic_Designer_costs__c, (SELECT Name, Product_Type__c
from Q_Products__r)
from Quotation__c
WHERE IsTemplate__c = true
];
}
}
Page:
<apex:page Controller="QuotationController" tabstyle="Opportunity" >
<apex:form >
<apex:pageBlock title="Quotation Template">
<apex:pageBlockSection title="Available Starting Template">
<apex:pageBlockTable value="{!ListaQuotation}" var="f">
<apex:column value="{!f.Name}">
</apex:column>
<apex:column value="{!f.Q_Product_Consultant_costs__c}">
</apex:column>
<apex:column value="{!f.Q_Product_Program_Director_costs__c}">
</apex:column>
<apex:column value="{!f.Q_Product_Project_Manager_costs__c}">
</apex:column>
<apex:column value="{!f.Q_Product_Senior_Graphic_Designer_costs__c}">
</apex:column>
<apex:column value="{!f.Q_Products_total_costs__c}">
</apex:column>
<apex:column >
<apex:facet name="header">Related Products</apex:facet>
<ul>
<apex:repeat value="{!f.Q_Products__r}" var="qp">
<li><apex:outputField value="{!qp.Product_Type__c}" /></li>
</apex:repeat>
</ul>
</apex:column>
<apex:column >
<apex:commandButton value="Select" id="a"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>