17

This is a bug inside the framework where dynamically created components are not getting properly indexed to their parents. Doesn't look like anyone is actively working on it right now. If you'd like to put some pressure on the devs who own this you can file a case and tell them to link the case to internal bug W-2529066.


11

Looks weird,might be a bug. As a workaround, try passing the stages array as string from the component and deserialize the string to List<BpiStage> in the apex controller. Controller.js ction.setParams({ bpiId : component.get("v.recordId"), stages : JSON.stringify(component.get("v.stages")) }); AuraMethod: public static void ...


10

You can access the attribute as v.navItemPrivs.Task and that should work just fine. Object properties are accessible by dot notation but not brackets unless they are integers. Unfortunately you can't bind to dynamically named keys (e.g. you can't do v.myMap[v.myKey] in Lightning so far). Be aware that under the current way Locker functions (as of Summer '16 ...


10

Very interesting question. I did some research on it and found this gitHub repository, someone has tried to play with default values of all kinds of basic types. Scene 1: Simply putting the below line doesn't work. <aura:attribute type="Datetime" name="datetimeDefaultWithTimeString" default="2013-03-06T10:17:36.789Z"/> however if you do the exact ...


9

I'm afraid you won't be able to do it. As @itzmukeshy7 said, the way to go is to pass the Date as a String and then cast it inside your Apex method. There are several issues like this currently in the framework, I've published a blog post to try to list them and their related workaround, you can have a look here if you're interested. I would suggest that ...


8

init event of the child component will called long before the parent's. Add aura:doneRendering event in the child component and access the list in in the child. Order in which init fired is mentioned in the developer guide and in this article too. When the component tree is ready, the init event is fired for all the components, starting from the ...


8

I think that the problem is in javascript when you are declaring mySet. Try this: var mySet = new Set(component.get("v.mySet")); Edit: the best solution is var changes = cmp.get("v.changes") || new Set();


7

UPDATE I believe this is a bug. If you do not default your Map to empty object default="{}", then lightning appears to not register the existence of the Map declared in the markup. So, the fix is simple - change your attribute definition to this: <aura:attribute name="FilesNameMap" type="Map" default="{}"/> PREVIOUS You have a typo. In your ...


7

get is faster than find and then get, simply because the latter requires calling two methods while the former only requires one method. In addition, find may return either no values (null), one value (a SecureComponent), or multiple values (an Array), so you might need to introduce additional logic depending on your component's design, while get will always ...


7

This was intentionally designed this way, and reason for that is an edge case. You can still change the value, you simply need to clear the reference before setting it first. ({ changeValue: function(cmp, evt, helper) { cmp.clearReference("v.value"); cmp.set("v.value", 10); }, }) Lets tell a little bit of a story here to explain ...


7

If I read this right, you want to use an inner class on aura:attribute tag. You cannot (rather should not) use an inner class as an aura attribute, instead you need to handle it differently. If that's what you are looking for, refer to the below excerpt from documentation: Custom classes used for component attributes shouldn’t be inner classes or use ...


6

You get the below error if the <aura:method/> is not an direct child of <aura:component/> No COMPONENT named markup://aura:method found” when saving component <aura:component> <div> <aura:method></aura:method> //ERROR </div> </aura:component> Placing it as the direct child of <aura:component/...


6

This issue is currently scheduled to be fixed in the Summer '17 release by leveraging Proxy as Doug mentioned in the comments to another answer. I've verified the fix with a very similar scenario on the Summer '17 codeline. Unfortunately, the fix is not scheduled to be patched in to Spring '17 as initially hoped for.


6

Use a method to set the value from VF page. @AuraEnabled public static CLASSNAME GetProp () { CLASSNAME result = new CLASSNAME(); result.prop = value; return result; } In the component: <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <aura:attribute type="CLASSNAME" name="var" /> Value is = {!v.var.prop} </...


6

You cannot dynamically calculate the value of sum via markup expression in Lightning Component. You need to calculate the value in the controller.js and store in a separate attribute in the component during the initialization. markup <aura:attribute name="values" type="List" default="[0,0,1,0,0,1]" /> <aura:attribute name="sum" type="Interger" /&...


6

As Kris Gray (@GrayJustise) pointed out on Twitter once, Object is a simple Object, and Lightning doesn't know what to do with it, so it does this only safe thing it can: it makes it a String. Instead, use a Map, which tells Lightning that you have a key-value pair in there you're trying to parse: <aura:attribute name="jsObj" type="Map" default="{'aValue'...


5

Edit: lightning:input has label and name as required attribute. <lightning:input aura:id="boatRevw" label="Title" name="Title" value="{!v.boatReview.Name}"/> Your boatReview attribute is null. You need to assign a default value to it as I guess you want to take fresh input and not displaying data from server in edit mode. <...


5

Yes, absolutely. You can use expressions in the class attribute of your Lightning components and HTML elements. <div aura:id="myDiv" class="{! v.myBooleanAttribute ? 'my-class-good' : 'my-class-bad' }"> It's common to use the ternary operator ?: as a shorthand when referencing Boolean attributes to embed conditional logic here. You could also ...


4

I've had this happen before and was able to resolve it by using a default attribute to predefine the keys/values of the object fields that you want to bind on. Try something like this: <aura:attribute name="testObject" type="Account" default="{ 'sobjectType':'Account', 'Name' : ''}" access="global"/>


4

Thank you for the demo code. I have confirmed the problem and filed a bug. Here are the conditions to get the component leak: LockerService enabled Nested <aura:iteration> The inner elements of the iteration has arrays. In other words, [[1,2,3]] is fine but [[ [ ], [ ], [ ] ]] leaks the elements in the second iterations 3 times, [[ [ ], [ ], "A"]] ...


4

as @techbusinessman stated, the only workaround (so far) to get the value from a dynamically created component is to use : var value = component.get("v.*attributeName*").get("v.value");// for type="Aura.Component" or var value = component.get("v.*attributeName*")[0].get("v.value"); // for type="Aura.Component[]" posting it again so that it would help ...


4

Code is working as expected. In the above approach there is basic problem. Lightning does not initialize any variable itself. In controller testString is not defined so, it is not even getting set and result {}:- public class myProblemClass { @AuraEnabled public string myTestString {get;set;} public myProblemClass(){ } public ...


4

First of all, using attribute name as value is not recommended. The reason for not getting the expected value in the alert is that the method named doInit is fired much before the value is passed to the component. For getting the value, you can use another handler as follows, Suppose your attribute name is myvalue, <aura:handler name="change" value="{!v....


4

If you're going about it the way you are, you'd want to use Component#find and then Component#get to get the value: action.setParams({ "name" : cmp.find("houseNameInput").get("v.value"), "address" : cmp.find("houseAddressInput").get("v.value") }); You use Component#find to get a component by aura:id, and then Component#get to get the value from ...


4

Application event handlers cannot have name. In the same link you have added in the question read it through and it has the information. Only component event handlers have name. <aura:handler event="c:aeEvent" action="{!c.handleApplicationEvent}"/>


4

Your CSS selector is apparently incorrect. It should be: .THIS .imageview { Instead of: .THIS.imageview { Use the latter for top-level elements, and the former for nested elements, such as those found in a lightning:layoutItem. You'll also note that your labels are not bold, because you've used .THIS.label instead of .THIS .label. You should almost ...


4

You can replace } with unicode \u007D and it is working. I just tried. <lightning:button label="{! 'label {1' + '\u007D' }" /> Gives the output:


4

As mentioned in the documentation Calling a Server-Side Action a callback is called after the server-side action is completed and $A.enqueueAction(action) adds the server-side controller action to the queue of actions to be executed. This means that the value hasnt been set in your attribute as of yet, so, when your "second" console log is geing executed,...


3

Unlike force:recordEdit/reviewView the forceChatter:feed component does not support dynamically changing v.subjectId - I just went and looked and there is no logic in the component to trigger reloading the feed when subjectId changes. The component does have a refreshFeed() method but its not marked access="GLOBAL" so no joy there either. Same for the ...


3

Hyphens are not allowed when declaring a variablle. I suggest you to rename the variable with underscore.


Only top voted, non community-wiki answers of a minimum length are eligible