You need to sign in to do that
Don't have an account?
bluecap
Lightning Component with Custom Class - Setting class properties post initialization
Hi everyone,
Im stumped on an issue and could use some guidance from the community. So to begin, Ive followed the steps out lined in the post here:
http://bobbuzzard.blogspot.com/2015/07/lightning-components-and-custom-apex.html
There I was able to create and initialize my Custom Class and its properties successfully. Now Im trying to update those custom class values in the JS Controller/Helper when a client side action (onblur) occurs, but I am running into a "Cannot read property" error when trying to SET the value of the custom class properties. So referring to Bob's example, I basically want to do this when an event occurs...
component.set('v.counts.numContacts', 50);
..but this returns the following error...
Action failed: c:Component_Calculator$controller$updateTotals[Cannot read property 'numContacts' of null]
Im in the process of creating a lightning component that will preload values on a calculator/estimating tool of sorts. So once the values are initially loaded I want to allow the user to be able to modify the preloaded values that in turn adjusts the total values. All of the values are held within the Custom Class.
All replys are appreciated. Thanks ahead of time.
Im stumped on an issue and could use some guidance from the community. So to begin, Ive followed the steps out lined in the post here:
http://bobbuzzard.blogspot.com/2015/07/lightning-components-and-custom-apex.html
There I was able to create and initialize my Custom Class and its properties successfully. Now Im trying to update those custom class values in the JS Controller/Helper when a client side action (onblur) occurs, but I am running into a "Cannot read property" error when trying to SET the value of the custom class properties. So referring to Bob's example, I basically want to do this when an event occurs...
component.set('v.counts.numContacts', 50);
..but this returns the following error...
Action failed: c:Component_Calculator$controller$updateTotals[Cannot read property 'numContacts' of null]
Im in the process of creating a lightning component that will preload values on a calculator/estimating tool of sorts. So once the values are initially loaded I want to allow the user to be able to modify the preloaded values that in turn adjusts the total values. All of the values are held within the Custom Class.
All replys are appreciated. Thanks ahead of time.
You should post your code because that works (get/set for each fields).
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_attr_values.htm
This test works:
All Answers
You should post your code because that works (get/set for each fields).
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_attr_values.htm
This test works: