You need to sign in to do that
Don't have an account?

How do you get the size of a list/array in lightning controller?
Hi. I actually have two quesitons. First, is the following a list or array?
var gs = []
Second, how do I determine the size of that variable? console.log(gs.size()); renders an error
Finally, how do I determine the size of an attribute for a custom oject. For example, I have the following attribute on my component:
<aura:attribute name="newGroupStructures" type="Group_Structure__c[]"/>
How can I write a console.log to see the size of that?
thanks!!!!
Fred
var gs = []
Second, how do I determine the size of that variable? console.log(gs.size()); renders an error
Finally, how do I determine the size of an attribute for a custom oject. For example, I have the following attribute on my component:
<aura:attribute name="newGroupStructures" type="Group_Structure__c[]"/>
How can I write a console.log to see the size of that?
thanks!!!!
Fred
Greetings to you!
Size of the array:
Size of an attribute:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
Greetings to you!
Size of the array:
Size of an attribute:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Here are how the attributes are defined on the component:
<aura:attribute name="existinggroupstructure" type="Group_Structure__c[]" />
<aura:attribute name="CloneNumber" type="Integer"/>