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
Hari Neelalaka Kanchibhotla 3Hari Neelalaka Kanchibhotla 3 

Create checkboxes and pass selected row id values for each grouping to controller

Hi All,

I am facing diificulty to pass selected checkboxes values from groupWrapper which contains 3 lists as below. I am displaying details on VF page such as product rows for each ShipTo are grouped, then tax records are grouped for each product row detail. Basically 1 ShipTo has Mutliple Product rows and each product may have more than one Tax row details. Since these are nested under multiple tables, I have created 3 individual checkboxes but unable to capture these selected rows into controller. Please help me with suggestions

/* wrapper class to hold ShipTo, Related Products and Taxes details */
    @TestVisible public class InvoiceWrapper
    {
        public Invoice__c shipToLst {get; set;}
        public List<Invoice__c> productLst {get; set;}  
        public List<Tax__c> taxLst {get; set;}
        public Boolean shipToSelected {get; set;}
        public Boolean prodSelected {get; set;}
        public Boolean taxSelected {get; set;}
        
        public InvoiceWrapper()
        {
            shipToSelected = false;
            prodSelected = false;
            taxSelected = false;
        }
    }

/* Invoked when selected row is invoked , here only shipToSelected under wrapper list is captured. Other 2 boolean variables are recorded as False even though they are checked */
public PageReference getSelected(){
    
        for(InvoiceWrapper invwrapper : invoiceWrapperLst){
        
            system.debug('***:'+invwrapper.shipToSelected);
            system.debug('***:'+invwrapper.prodSelected);
            system.debug('***:'+invwrapper.taxSelected);
            
            selectedRows.clear();
            if(invwrapper.shipToSelected == true)   
                selectedRows.add(invwrapper.shipToLst);
        }
        system.debug('***:'+selectedRows);
        return null;
    }
Krishna SambarajuKrishna Sambaraju
Are you getting this problem only in the test class?
Hari Neelalaka Kanchibhotla 3Hari Neelalaka Kanchibhotla 3
This is in the main apex class not in the test class
Krishna SambarajuKrishna Sambaraju
Can you share your Visualforce page and full controller? I will then be able to help you.
Hari Neelalaka Kanchibhotla 3Hari Neelalaka Kanchibhotla 3
I am unable to paste entire code here, can you share your email where I can send you the VF and apex class code.
Krishna SambarajuKrishna Sambaraju
Here is my email ksambaraju66@gmail.com