Questions tagged [aura-attribute]

Describes an attribute available on an app, interface, component, or event of the aura framework

Filter by
Sorted by
Tagged with
15
votes
3answers
4k views

Dynamically created component with aura:id, set as a Facet inside a parent component, is not found when calling find() and passing in aura:id

I would have expected that when a dynamically created lightning component is assigned as another component's attribute of type Aura.Component[], also referencing it in the parent component's markup ...
15
votes
1answer
3k views

Salesforce System Error when accessing a list in @AuraEnabled method

My Lightning Component controller: doActivateNext : function(component, event, helper) { var action = component.get("c.activateNext"); action.setParams({ bpiId : component.get("v.recordId"), ...
15
votes
1answer
117 views

Passing calculated values to components makes them immutable

I'm calculating a value while I pass it to a component. But for some reason this makes it immutable, so I can't update it in my component. These are some cases I played with: <aura:application ...
11
votes
3answers
2k views

Lightning: dynamic index in aura attribute with type List

related post I am having the same issue. Trying to access array with dynamic index arrayList[index] (index from aura:iteration), but Salesforce doesn't support that. Does anyone know how to do this?...
9
votes
1answer
5k views

Using a Map type attribute in aura:if

Trying to create a custom Navigation Bar and display menu entries based on user privileges. I defined this attribute in my component: <aura:attribute name="navItemPrivs" type="Map" default="{ ...
9
votes
1answer
4k views

How to pass Date from Lightning to Apex

In Lightning component I have attribute and input for date: <aura:attribute name="myDate" type="Date"/> <!-- ... --> <ui:inputDate aura:id="my-date" labelClass="slds-form-...
9
votes
0answers
763 views

How to set attribute in the designer to a string-value which contains expression-tokens like “{!…}”?

I have defined a string attribute like <aura:attribute name="pageParams" type="String" default="" access="global" /> and in the design <design:attribute name="pageParams" label="Custom ...
9
votes
4answers
6k views

Uncaught TypeError: a.getAttribute is not a function

Scenario: I have a component that has an <aura:renderIf> within an <aura:iteration>. The <aura:iteration> references a component attribute called "selectedItems" to display a list ...
8
votes
3answers
767 views

Not able to make Lightning Component work outside Managed Package Dev Org

When I package my app in Managed Package for outside world, the other org gets "Internal Server Error" when the Lightning Component Tab is loaded in S1 or new Lightning Experience interface. I worked ...
7
votes
2answers
4k views

What's the correct format to set a default value to a DateTime aura:attribute?

I would like to set a default value to a DateTime aura:attribute, but could not find the correct format. I tried the following but it didn't work: <aura:attribute name="myDateTime" type="DateTime"...
7
votes
1answer
12k views

Aura : Input Select , Drop Down

Component Code : <aura:component controller="TestController" implements="forceCommunity:availableForAllPageTypes"> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> ...
7
votes
1answer
851 views

Binding Javascript Objects to Aura Attribute Collection Types

I was testing Javascript Object Types and trying to bind them to aura attribute Collection types unsuccesfully client-side (for the most case), so I was wondering if there is a reference with a set of ...
6
votes
2answers
2k views

Why won't my Lightning Component Attributes store entered value

2/15/2017 Update Per comment from Doug in one of the answers this is an issue with Locker service. I verified that with Locker disabled is works as expected... In Spring 17 as of today, with locker ...
6
votes
1answer
549 views

How to prevent the component from being destroyed when it is referenced in multiple places?

I am referencing the component instance X within multiple other components dynamically. When I remove component instance X from one of the components, it is removed everywhere. The question is: how do ...
6
votes
2answers
515 views

For lightning component how do we set numeric keyboard instead of qwerty keyboard for ui:inputNumber in touch devices?

I've created a form inside a component with ui:inputNumber <ui:inputNumer /> But on clicking it in my mobile device, i'm always getting a qwerty keyboard. How do we set numeric keyboard ...
5
votes
3answers
4k views

Check component attribute exists

How can I check whether a certain attribute is existing within my component? Especially when I try to access a value dynamically like component.get("v." + fieldName) I want to make sure this is not ...
5
votes
2answers
108 views

Detect lightning:recordForm change in mode attribute

I'm trying to disable some surrounding components based on the mode attribute within lightning:recordForm (i.e. anytime I'm in edit mode, I'd like to disable a lightning:buttonMenu that sits just ...
5
votes
2answers
2k views

How to store a dynamically created component in attribute of parent component using Aura.component[]?

Scenario: Re-use of dynamically created components by storing them in Aura.component[] attribute in parent component. Use-case I am creating dynamic components in a parent component, and am ...
5
votes
0answers
172 views

Can I set an ECMAScript 6 Javascript Map() Object as a Lightning Component Attribute?

I have a scenario where I am building a Javascript Map() object in my client controller helper of a Lightning component. Ideally, I would like to use this map for client-side filtering in a component. ...
5
votes
2answers
7k views

How do you set a default value on lightning component force:inputField which is a lookup?

I have a lightning component (Summer 16) which contains a "Task" attribute as follows: <aura:attribute name="task" type="Task" default="{ 'sobjectType': 'Task' }"/> Further down the page, ...
4
votes
1answer
1k views

How to handle attributes of type “Set” in Lightning?

I am trying to collect record Ids of changed records. Therefor I'm using aura:attribute type="Set". But whenever I add the same id twice, it will be twice in my set. As described in the documentation, ...
4
votes
1answer
677 views

Lightning Components: declare attributes or get the values from the DOM?

The question is fairly simple, but I haven't found any answers on the web. At the moment I have found two ways of getting the UI's values: Setting up an <aura:attribute type='Object' name='myName'...
4
votes
1answer
5k views

Aura Attribute of Type Map is not working

I have declared an auro Map attribute in my Lightning Component but when i try to set key value pair to the Map in CLient-Side Controller it throws null error. COMPONENT CODE : <aura:component ...
4
votes
1answer
594 views

How do I use a JavaScript object as an aura:attribute?

How do I use a JavaScript object as an aura:attribute? Should I do it this way <aura:attribute name="jsObj" type="Object" default="{aValue: 5}"/> or another?
4
votes
1answer
49 views

How to assign a right curly bracket } as attribute value inside the markup of a lightning component?

In the markup of a lightning component I want to set this string a the value for a label-attribute: "label {1}" Let's take a lightning button as an example. But my question is unspecific and ...
4
votes
2answers
131 views

When do you need to use default="{'sobjectType': 'ObjectName'} for an aura:attribute?

I'm getting the below error- when I type into a lightning:input whose value attribute is bound to a field on the custom object- when I don't use the default attribute. Is this because the default ...
4
votes
1answer
6k views

Redirect to new lightning page be clicking button. Setting parameters to component in new page

I have lightning component which I put into lightning page using App Builder. The component display table with field history tracking like in the Salesforce Classic. Also there is a button on ...
4
votes
1answer
163 views

Differentiate Lightning init design time from run time

I have a component that needs to behave differently during the design an runtime (it makes a web service call which might incur charges). How do I figure out if I am in the design or run time? I don'...
4
votes
1answer
154 views

Bound data binding does not work with list items

Let me start by showing you what I am doing. ParentAppWithListAttr.app <aura:application > <aura:attribute type="List" name="justAList" default="['hello','world']"/> <aura:...
4
votes
1answer
859 views

Unable to save a record using LDS

I use lightning data service method SaveRecord to create a record of type BoatReview__c. The boatReview__c object has following fields: I only populate Name and comment__C field using a form on my ...
4
votes
1answer
2k views

How to limit maximum number of characters that can be typed into input field? maxlength attribute not working

I'm using the UIInputField. I want to limit the numbers of characters that can be typed into input field, however, there is an issue. I tried using the "maxlength" attribute, but it doesn't effect ...
3
votes
1answer
3k views

Lightning Components - Are passed in attributes available to the init method?

All, This may be a basic question, but I've Googled around it and haven't found an explicit piece of documentation to back it up. I have a Lightning component with a required attribute which is a ...
3
votes
5answers
788 views

Aura Components are being aggregated on 'items' change of aura:iteration

I've created a simple component to show my issue: Markup (testComp.cmp): <aura:component description="testComp"> <aura:attribute name="testAttr" type="List" default="[[[1, 2], [2, 3], [3, ...
3
votes
2answers
1k views

component.get is giving null on parents component's controller

I am trying to pass a string literal to parent component as attribute. Child Component code: <div class="slds-form-element slds-hint-parent slds-has-divider--bottom"> <h1>{!v....
3
votes
2answers
2k views

Unable to set an Inner Class as Aura Attribute type

Since SF update to Summer 18, we are facing this issue where an Inner Class could not be set as an Aura Attribute type. Lightning Component <aura:component implements="force:...
3
votes
1answer
1k views

Lightning Object binding via attribute

Can someone explain me, why object binding is not working? cmpOne.cmp <aura:component extensible="true" abstract="true" access="global"> <aura:attribute name="testObject" type="Account" ...
3
votes
1answer
469 views

Why should I even use the SObject type for the aura:attribute type?

Sometimes I see code using the SObject type as an aura:attribute type and I don't see why! <aura:attribute type="Account" .. It feels like it behaves the same as "Map", it's just a javascript ...
3
votes
1answer
464 views

How to restrict 'Paste' action in lightning component

We are trying to implement Re-Confirm email id functionality, to capture email address twice on the form. For this on the second email address field we want to restrict paste action by user. We are ...
3
votes
1answer
700 views

Aura iteration over array of objects accessing key values

I am using aura:iteration to iterate and show images on my lightning component. Which looks like below: <aura:iteration items="{!v.Assets}" var="asset"> <img src="{!asset.asset-url}"/> &...
3
votes
1answer
2k views

Aura component cannot read property '$getActionDef$' of undefined

I when I press button, I get a lightning alert popup with an error: Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the ...
3
votes
1answer
2k views

Unable to save Lightning Component because of Save error for Custom Apex Class type attribute

I'm trying to create a Lightning Component and there is a Custom Apex Controller class with a child class in it. But I'm receiving an error like this: Failed to save undefined: No TYPE named apex://...
3
votes
2answers
276 views

How to use v.sObjectName to define fields in Lightning Data Service

To use my Lightning component for record pages of multiple types I need to load the record in a generic fashion. <aura:component controller="MyCtrl" implements="force:hasRecordId,force:...
3
votes
3answers
2k views

Make a lightning component attribute available to children

I have a component that's really just a container. I'd like to be able to set an attribute on the container and have that attribute be able to passthrough anything I put inside the container without ...
3
votes
2answers
357 views

Lightning component attributes: Difference between Array and List

According to this document, the type type[] is "An array of items of a defined type" and the type List is "An ordered collection of items". I've tested the output of both structures (with integer ...
3
votes
1answer
172 views

How do I implement unbound data binding in Lightning controllers

I know in Lightning components I can use {#v.attr} to provide independent usage of data. But how about JavaScript, is there something similar I could do when setting a components attribute? I'm doing ...
3
votes
1answer
282 views

Aura Attribute of Type Object is Supported in Flows?

I am working on a Flow Screen and trying to assign a value to a lightning component attribute from a variable in the flow. The flow screen allows me to select the lightning component but it doesn't ...
3
votes
2answers
344 views

password design attribute

My component has a property that is a password to a web service. The current data types for design view are String/Int/Bool and they all display during the design time. Is there a way to display a ...
2
votes
2answers
474 views

How to bind aura enabled property to lightning component?

@AuraEnabled public string prop { get; set;} I need to bind above apex controller property to lightning component. Please help me on this.
2
votes
2answers
442 views

How to set inner class list as aura attribute? [closed]

I am in need of showing a list of records in a summarized format, say all records belonging to Type 1 are displayed first, followed by the records of Type 2, and so on. Usually in visualforce page, ...
2
votes
1answer
2k views

increase sum in aura:iterator

How do I create a sum within an aura:iteration? <aura:attribute name="sum" type="Integer"/> <aura:iteration items="[0,0,0,1,0,0,0,0,0,0]" var="item"> do something with {!item} &...