+ Start a Discussion
Greg FinzerGreg Finzer 

How to improve checkbox click performance

My lightning component has over 1000 checkboxes.  Salesforce is extremely slow when clicking or unclicking a checkbox (around 20 seconds).  Here is my checkbox defininition:
 
<ui:inputCheckbox aura:id="elementCheckbox" name="{!element.GroupId}" value="{!element.Renovated}" click="{!c.handleCheckboxClick}" />

The custom code in the handleCheckboxClick event returns immediately (milliseconds) but there is something else happening in Salesforce that is taking all of the 20 seconds.  

Is there something I can do to speed up performance?

Can I bind to a regular HTML checkbox in lightning with the same click event?
Ajay K DubediAjay K Dubedi
Hi Greg,
I see that you are using simple ui tag to achieve your objective. Salesforce has released its lightning alternative while ago. I recommend you to use lightning tags instead of simple ui tags to improve effiecieny of your code. For example insted of ui:inputCheckbox you can use <lightning:input type="checkbox" label="Basic option" name="input1"/>.
Further you can also provide aura:id for a group of fields to find and get value faster in controller. Further for tabulated data you should use lightning:datatable which has advanced functionalities and is also much efficient than normal HTML table.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi