You need to sign in to do that
Don't have an account?
sridharb
lightning attribute with same type are behaving same although named differently
For Example
If I have 2 attributes as like below defined with same type as 'Account' or any in a lightning component
Account will be displayed as the form with firstname and last name and mobile where allowed to view and edit. When operation for edit and in the middle of editing clicked on cancel button, so wanted to display back form with original values, so delcared one more attribute as Account which has been set on Init as the copy of customerdetails.
But thought form elements refers to customerdetail attribute from the component definition, retainCustomer attributes also reflecting to same values as CustomerDetails. Which is all because of same type. I experienced this problem with custom type attributes but its now look like the general defect from Lightning
Anyone experienced same problem oand any thoughts on it.
For more clear
This is what I was doing at Componet controllers
but no luck seems like for work around i need to retain them indivudually to a colelction instead as same type Account.
Thanks
sri
If I have 2 attributes as like below defined with same type as 'Account' or any in a lightning component
<aura:attribute name="retainedCustomer" type="Account" access="public"/> <aura:attribute name="customerDetails" type="Account" access="public"/>The reason i defined 2 same is,
Account will be displayed as the form with firstname and last name and mobile where allowed to view and edit. When operation for edit and in the middle of editing clicked on cancel button, so wanted to display back form with original values, so delcared one more attribute as Account which has been set on Init as the copy of customerdetails.
But thought form elements refers to customerdetail attribute from the component definition, retainCustomer attributes also reflecting to same values as CustomerDetails. Which is all because of same type. I experienced this problem with custom type attributes but its now look like the general defect from Lightning
Anyone experienced same problem oand any thoughts on it.
For more clear
This is what I was doing at Componet controllers
doInit : function(component, event, helper) { component.set("v.retainedCustomer",component.get("v.customerDetails")); },when clicked on Cancel
component.set("v.customerDetails",component.get("v.retainedCustomer"));
but no luck seems like for work around i need to retain them indivudually to a colelction instead as same type Account.
Thanks
sri
It's due to object reference values
you need to change as I hope this will help you Let me know
Regards
Ashif
All Answers
Help me with your controller and helper function where you are exactly adding data to these attributes. The thing is it will be better to create two separate javascript variables while assigning values from one attribute to another as the space created for storing those values will be different. It seems for both the attribute javascript is sharing the same address space.
Thanks for the reply and sparing time.
Actually customerDetails being set from the components parameters pass
retainCustomer is been set when that component initialized,
In general any programming language would create dynamic reference for both, however being poor inn Java script I will respect your doubt and give a try. ll keep you posted
Thanks
Sridhar
It's due to object reference values
you need to change as I hope this will help you Let me know
Regards
Ashif