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
Sachin Bhalerao 17Sachin Bhalerao 17 

how attribute type = List will work?

Dear Team ,

Greetings !!!

Please clarify me how   <aura:attribute name="mycolumns" type="List"/>

Type=List will works in Attribute how it is different from array.
Best Answer chosen by Sachin Bhalerao 17
Deepali KulshresthaDeepali Kulshrestha
Hi Sachin,



Both are the same. You can pass an array to the attribute of type list and it will work fine. 



In the lightning component, you can use this using tag and replace the Your_Attribute_Name with your attribute name.



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



Thanks and Regards,

Deepali Kulshrestha

www.kdeepali.com

All Answers

Team NubesEliteTeam NubesElite
Hi Sachin,
An "ordered" object means the values will appear in the same order each time you access the variable. This is in contrast to an "unordered" object, which may return its values in different orders each time you use them. For example, an Object can return an unordered list of keys. There is no guarantee as to the order the keys will appear from time to time.
In the strictest sense, List and Array are exactly the same. However, we are encouraged to use the case-sensitive Apex version of an object. What this means is that you should define an attribute as a List and not an Array. This is simply how Lightning (or, more specifically, Aura, the underlying runtime) has been designed. Similarly, it's recommended that you use a Map instead of an Object to avoid potential side effects.


Thank You
www.nubeselite.com
Development | Training | Consulting

Please mark this as solution if your problem resolved.
Deepali KulshresthaDeepali Kulshrestha
Hi Sachin,



Both are the same. You can pass an array to the attribute of type list and it will work fine. 



In the lightning component, you can use this using tag and replace the Your_Attribute_Name with your attribute name.



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



Thanks and Regards,

Deepali Kulshrestha

www.kdeepali.com
This was selected as the best answer