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
Sergey VolinetsSergey Volinets 

How does map type of attribute work? How can I receive keys and values from map?

How does map type of attribute work? How can I receive the list of keys and list of values from the map in JavaScript?

I receive data from apex method, and I would like to use aura:attribute with map type to keep Id and Quantity, Is it possible to keep it on the client side using map type of attribute?
<aura:attribute name="OpportunityLineItem" type="Map" default="{ '0065800000CINW0': 'name1', '0065800000CINWP': 'name2' }" />

sfdcMonkey.comsfdcMonkey.com
hi Sergey Volinets 
go to below link for it.
http://www.sfdcmonkey.com/2016/11/16/how-to-use-map-in-lightning-component/
http://www.sfdcmonkey.com/2017/01/13/iterate-map-values-lightning-component/

Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks
sfdcmonkey.com
Abhishek Sagar 1Abhishek Sagar 1
<aura:attribute name="OpportunityLineItem" type="Map" default="{ 'Id': '0065800000CINW0', 'name':  'name2' }" />
var oliMap = component.get('v.OpportunityLineItem');
alert(OpportunityLineItem.Id);
OpportunityLineItem.Name = 'name3';