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
Surya.236Surya.236 

Multiselect checkbox is not working when we have one record.

Multiselect checkbox is working wehn i have one record.
please suggest.
Below is my code. I've copied the code from below Link in my dev Org. If I have 2 or more records it is working.
If I have one record and  if i select the chcek box it is not selecting the all checboxes.
Code from below URL
https://www.biswajeetsamal.com/blog/lightning-table-with-multiple-checkbox-select-options/
ShirishaShirisha (Salesforce Developers) 
Hi Surya,

Greetings!

I would suggest you to capture the debug logs while trying to select the checkbox which is not working as expected to know,if there is any error like "List Has no rows for SObject" which help you to fix the issue.

Reference:https://help.salesforce.com/apex/HTViewHelpDoc?id=code_add_users_debug_log.htm&language=en_us

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Surya.236Surya.236
Hi Shirisha,

in Logs I'm getting undefined. below is the code

handleSelectAllContact: function(component, event, helper) {
        var getID = component.get("v.contactList");
        var checkvalue = component.find("selectAll").get("v.value");  
        var checkvalue1 = component.find("selectAll")
        var checkContact = component.find("checkContact");
        console.log('size-'+checkContact.size );
        console.log('-check'+checkvalue1.length );
        
        if(checkvalue == true){
            console.log('#####-'+checkContact.length );
            for(var i=0; i<checkContact.length; i++){
                checkContact[i].set("v.value",true);
            }
        }
        else{ 
            for(var i=0; i<checkContact.length; i++){
                checkContact[i].set("v.value",false);
            }
        }
    }