Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [lightning-web-components]

This tag is for questions related to JavaScript, CSS, or Markup when used in the Lightning Web Component (LWC) programming model, or for questions of interoperability between LWC and the original Aura-based lightning components.

0
votes
0answers
10 views

Parse JSON in LWC

I'm getting a JSON response as follows :- tthis.selectedRecord {"Id":"01t5C000002xxx","Name":"xxxES"},wanted to know how do i get the value of ID & Name separately.
0
votes
1answer
20 views

Are pre built lightning web components (example lightning-input) available for use in open source?

I just tried using LWC on my local, but not able to use <lightning-input />. Is it available for open source? Is there any way to bring prebuilt lightning web components with lightning namespace ...
0
votes
0answers
17 views

Warning / Error when ShowToast closes in LWC

I believe I've found a minor bug / issue but would like to confirm. If there's a better place for me to put this bug report, please advise. I've tested this in both my own application as well as the ...
1
vote
0answers
23 views

Is there a way to prevent navigation from standard new record page after save

I have a Lightning web component that uses Navigation Mixin to show create new record page for a custom object. I am using the following function for this. this[NavigationMixin.Navigate]({ ...
0
votes
0answers
14 views

I'm having trouble. I would like if the test field is selected. Test2 is search-enabled

<c:customLookup aura:id="teste" objectAPIName="teste" IconName="custom:custom36" label="teste" selectedRecord="{!v.teste.Id}" /> I tried to use the onLookupChange of the lookup itself <c:...
-1
votes
1answer
30 views

A @track decorator can only be applied to a public field

I'm getting the following error from Salesforce whenever I try to create a Lightning Web Component app: Action.prototype.finishAction Error [Error in $A.getCallback() [Assert Violation: Compiler ...
0
votes
0answers
44 views

Any LWC on a record page layout in a subscriber org throws Internal Error

We have LWC's created in our managed package. They are marked as exposed. Whenever we try to include one in a record / flexi page in a Subscriber's org we are getting an internal server error with an ...
0
votes
1answer
29 views

importing SLDS or Lightning CSS in LWC (Locally)

Now that LWC can be built locally I'm trying to create a simple data table but CSS won't apply. I'm sure I'm doing something wrong while importing or referencing the SLDS CSS file. Can someone please ...
0
votes
1answer
19 views

Unable to Populate Expanded Rows in LWC lightning-tree-grid

I have a Lightning Web Component with a lightning-tree-grid, and I want it to load with all rows expanded. HTML (elements irrelevant to the question removed): <template> <lightning-card&...
1
vote
0answers
27 views

Dependent Combo-box in LWC

I have a combo-box in LWC - whose values get populated on load of the page with the help of @wire. The code is as follows: @wire(fetchL1ProductValues,{userType:'$userType',accountId:'$recordId'}) ...
0
votes
1answer
24 views

Text wrapping not working in LWC

I am trying to create two tables side by side with a space in between. One column has a long text which is not wrapping and table is going out of the page. If i do Ctrl+P to print, those two tables ...
1
vote
1answer
34 views

How do we manually call (child) LWC component method from (parent) Aura component?

I've two components: <c:Lightning_component_Aura> <c:lwcLightningWebComponent aura:id="myLwcComponent" /> </c:Lightning_component_Aura> I've declared a function inside LWC using @...
0
votes
0answers
18 views

Filtering not working properly with paging [on hold]

I have a Datatable of 500 entries, each page contains 50 entries. When I try to filter a property, I excepted it to filter all 500 entries, and paging the filtered result. But it only filter the 50 ...
0
votes
1answer
40 views

LWC Composition for fields inside a record-edit-form

I have a lightning-record-edit-form with multiple lightning-input-field. I'd like to put some of the input-field into a child component, say childComponent. The code is attached at the end. However,...
1
vote
0answers
27 views

Flexipage - LWC with no header

I have added a LWC component onto an APP page: <?xml version="1.0" encoding="UTF-8"?> <FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> <flexiPageRegions> <...
0
votes
0answers
17 views

LWC Record page - highlighted tab

I have a custom record page in LWC which is navigated to from a custom App Page (also in LWC). I want the custom App Page to stay highlighted (the same way as the Custom Object tabs stay highlighted ...
2
votes
0answers
21 views

LWC datatable column width responsive

I have a LWC component (NOT Aura) that has a datatable with just one column. By default, the width of that column is 1000 px, which is way too small. Using max-column-width="4000" or similar on the ...
0
votes
0answers
22 views

afterRender threw an error in 'c:tripList' [pubsub listeners need a “@wire(CurrentPageReference) pageRef” property]

I am attempting to fire events between two lightning web components. Both js files contain the line @wire(CurrentPageReference) pageRef; in the files, yet when I attempt to load the page containing ...
6
votes
1answer
89 views

Lightning Web Component (LWC) not evaluating if:true from test

I am trying to write some Jest test for my LWC and is encountering issue evaluating the if:true attribute. Below is a sample of my code: import { LightningElement, track } from 'lwc'; export ...
1
vote
0answers
29 views

LWC: Iterate through a dynamic query result

I've got a result from a query that can be from a different object, or with different fields. How would I iterate through these fields, using their labels as well? This is what I want the end result ...
1
vote
1answer
49 views

LWC | Get modified values of a list in javascript controller

I am having a lightning web component which iterates over a list and displays values in a list HTML: <template> <template for:each={myList} for:item="myRecord"> <div class="slds-...
1
vote
2answers
65 views

LWC: detect last element in for:each iteration

I'm trying to output a list of strings separated by commas in LWC, such as: cat, dog, mouse I need to use template for:each and output a list item and a comma, but only if the item is not the last ...
5
votes
0answers
57 views

Get records in Lightning web components without APEX

import { LightningElement, track, api, wire } from 'lwc'; import { getRecord } from 'lightning/uiRecordApi'; const FIELDS_SOLICITUD = [ 'DCABM_obj_solicitudABM__c.DCABM_fld_aplicacionSolicitud__c'...
0
votes
1answer
22 views

Pass body from Aura component to Lightning web component

I am facing one issue to pass body from aura component to lwc. optionGroup.html <template> <h1>Child LWC</h1> <slot></slot> </template> OptionGroupLWC.html ...
1
vote
0answers
45 views

Embedding LWC in Aura Component not working?

I'm trying to embed a Lightning Web Component inside an aura component (because I need some features only aura components support right now - populating default field values when using force:...
0
votes
1answer
25 views

LWC Lightning Record Edit Form Case Assignment Rules

Is it possible to somehow trigger case assignment rules upon creation of a case via a lightning-record-edit-form? It used to work when I had it set in page layouts but that seems to no longer be the ...
0
votes
0answers
21 views

Cannot paste table into lightning-input-rich-text

I have a lightning-input-rich-text inside of a wrapper lwc(so that i can use it inside of a Aura cmp) and when we try to copy over a table, it comes over in the form of a paragraph. Here is the code: ...
0
votes
0answers
43 views

Convert Select list to Combo box in LWC

I have created a select list in LWC. The code is as follows :- <select onchange ={onSelectProductL1} class="slds-select l1Cmp" data- id="select-01"> <option value="">--...
0
votes
1answer
50 views

Select list validation in LWC [on hold]

I have created a select list in LWC. The code is as follows :- <select onchange ={onSelectProductL1} class="slds-select l1Cmp" data- id="select-01"> <option value="">--...
4
votes
3answers
82 views

How to create a Lightning Web Component without Salesforce DX?

I want to create a Lightning Web Component (LWC) that be included in a managed package. Our current process uses SublimeText and Mavensmate (which I know is deprecated). We also use GitHub as our ...
0
votes
2answers
34 views

afterRender threw an error in 'c:TestLWC' [Cannot read property 'data' of undefined]

I am using the below code to make a call to apex method on page load and validate some response. I am getting error afterRender threw an error in 'c:TestLWC' [Cannot read property 'data' of ...
2
votes
1answer
42 views

How do I switch off the 'edited' highlighting in LWC lighting-datatable?

I'm using a lightning-datatable in LWC, and hooking into 'oncellchange' to ensure that any inline editing is automatically included in the underlying javascript data model immediately. I then have ...
0
votes
1answer
41 views

Lightning Web Component and NavigationMixin [duplicate]

In my LWC I'd like to open a standard "new record" dialog with predefined values. I know I can use: this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { ...
0
votes
0answers
34 views

LWC: Using “if” to condition CSS class dynamically in LWC [duplicate]

Sales force LWC: AIM:Want to Achive below code in LWC <template> <div key={attr1} class="{!if(attr1==attr2,'Class1','Class2')}" ></template>
0
votes
0answers
19 views

Get Child Records with getRecordUI in LWC

Trying to child records through the getRecordUI @wire(getRecordUi, { recordIds: '$recordId', childRelationships: 'PREFIX__OBJECT__c.PREFIX__CHILD_RELATIONSHIP_NAME__r', layoutTypes: 'Compact', modes:...
0
votes
0answers
15 views

How to create an agenda view on a record page for booking purposes?

I'm trying to create a booking type functionality where users can pick a timeslot for a specific day. Here's the record page: https://imgur.com/a/AQQLOcA Basically, I'm using JavaScript to just ...
0
votes
1answer
34 views

onsort datatable not invoke function in js lwc

For datatable column sorting, I have following datatable: <lightning-datatable title="MY ORDERS" data={data} columns={columns} key-field = "SalesDocument" onsort={updateColumnSorting} sorted-by={...
2
votes
1answer
48 views

LWC: lightning-input-rich-text does not update onchange

Trying to rewrite an aura component that loads an email template into a rich text field but the field does not update. The tracked value updates as I can see it if I output it. <lightning-...
7
votes
2answers
140 views

empApi with Lightning Web Components?

I have an LWC in which I want to use EMP API. Docs say that's only currently available in Aura. Do I have to wrap my entire LWC in aura in order to add the EMP API, or can I create a utility aura ...
1
vote
0answers
28 views

Error while running - npx lwc-create-app my-app

$ npx lwc-create-app my-app npx: installed 372 in 30.586s Error: Cannot find module './generators/CreateGenerator' at Create.run (~/.npm/_npx/3407/lib/node_modules/lwc-create-app/lib/index.js:12:...
1
vote
0answers
35 views

Use value retrieved from getFieldValue as argument to apex call in LWC

What I am looking to achieve is for a component on a Lightning record page to take the ID of the record in context, get the value of a field upon that record, then feed that into an Apex method to ...
1
vote
1answer
34 views

Does LWC @wire works with custom classes?

I'm trying to use @wire with a method that returns a list of my custom wrapper class. The list is returned, but the items have no fields. When I'm using @wire with List of SObject, everything is fine.
1
vote
1answer
40 views

$A.util.addClass() and $A.util.removeClass() in Lightning Web Components

Does anyone know of an equivalent to the Aura utility methods for adding/ removing style classes dynamically, or have some other workaround? https://developer.salesforce.com/docs/atlas.en-us....
0
votes
0answers
53 views

LWC design attributes doesn't work in the Community with Anonymous User

Did someone try to use LWC in Communities? I created component to dynamically render Knowledge articles based on provided Topic by passing Topic.Name as Design Attribute. It works in Builder, but ...
0
votes
1answer
41 views

Issue in create Two Column Layout

I have below code to divide a layout into 2 columns. <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1" style="height:230px;"> <div class="row"> <div ...
0
votes
0answers
26 views

onchange event not triggered on removal of last character - LWC

I need to display the count/length of string entered in a text box as and when changed(addition/subtraction of new characters) using LWC <template> <lightning-input ...
3
votes
1answer
54 views

LWC not recognizing PageRefrence changes and not displaying updated values

I have the below parent aura component which has parent LWC - On clicking redirect button on parent i am passing the attritubes in URL and the values are displayed on the child. This happens for ...
0
votes
2answers
58 views

Unable to use SLDS Icons in Lightning Web Component

I am developing an app and I need to add SLDS icon with custom color (i.e. green or blue) to the UI. Which is why I can't use <lightning-icon> component because you can override it style. Thus ...
2
votes
1answer
83 views

LWC Apex response handling. Cannot read property 'message' of undefined

I had a LWC component which simply update an record. When logic was in one file it was working fine. btn_newPhoneNumberClick() { const fields = {}; fields.Id = this.recordId; ...
2
votes
1answer
29 views

Re-Evaulating Selected-Rows in Lightning-Datatable When Data Changed

I've been stuck on this issue for a few hours now and don't seem to be getting any closer to resolving it. I currently have a Lightning-Datatable with pagination that renders 20 rows at a time. When ...