function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
L037242283804838405L037242283804838405 

page table -urgent for tomorrow

hi friends.
this is an urgent problem for sunday so thanks for fast answers.
i have a controller:
public class Shopping{

    public PageReference readCellMethod() {
        String id = ApexPages.currentPage().getParameters().get('rowID');
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,id);
    ApexPages.addMessage(myMsg);
    return null;
    }


    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Name, Price__c FROM Product__c]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
    public List<Product__c> getOpportunities() {
        return (List<Product__c>) setCon.getRecords();
    }
}

I have a visual force page:
<apex:page controller="Shopping">
<apex:form>
    <apex:actionFunction name="readCell" action="{!readCellMethod}">
        <apex:param name="rowID"/>
    </apex:actionFunction>
</apex:form>
    <apex:pageBlock >
    <apex:pageMessages />
        <apex:pageBlockTable value="{!opportunities}" var="o">
            <apex:column value="{!o.Name}"/>
            <apex:column value="{!o.Price__c }"/>
            <apex:column headerValue="Add" onclick="readCell('{!o.Id}')"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

my problem: i want to add a column with button or something that on click will add products to the customer chart.
i need to pass the product id(o.id)
to the controller.
of course i didnt success cause i am a total beginner.
what is the easiest way to do so?
thanks for your help guys :)!
Saravanan @CreationSaravanan @Creation
Hi,

By using <apex:param> only u can achieve this. Can you tell me what is the issues you are facing in the above code.

Thanks,