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.

1,185 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
0answers
478 views

State management/data binding with LWC with many related records

I'm creating a form that displays a fair amount of information and needs to be update-able. I've looked into using lightning data service and <lighnting-record-edit/view> components but there is ...
7
votes
1answer
3k 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'...
6
votes
1answer
76 views

LWC custom permission error in subscriber org: Invalid module id “MY_NAMESPACE__My_Custom_Permission” for type “customPermission”

I'm trying to access a custom permission in a Lightning Web Component. This is the js code in my managed package development org: import { LightningElement } from 'lwc'; import hasCustomPermission ...
6
votes
1answer
107 views

Event propagation with bubble true in LWC

I'm trying learn event propagation in lwc. As per the documentation says {bubble: true, composed: false} means the event does not cross the shadow boundary. but it bubble up the shadow boundary I don'...
6
votes
0answers
128 views

How to get a PageReference from Site.login(username, password, url) in an Apex Test

When I run this code from within a LWC controller: ApexPages.PageReference pageRef = Site.login(username, password, url); It returns a valid PageReference instance. But when I test the code in a ...
6
votes
0answers
1k views

How to upload larger size file using input tag of type html in LWC

I have implemented custom file upload component using input file html tag and rendering it as browse file button. The issue with component is:- When trying to upload file more than 4 mb of size, i ...
6
votes
0answers
495 views

External Objects not supported in Force.com sites

(Edit: all of this is happening only in a Force.com site. The Lightning Web Component is not the source of the problem) I'm trying to query an External Object inside @AuraEnabled method, but I'm ...
6
votes
1answer
5k views

querySelector not getting element in lightning web component

I am creating a popover, where I need to position it correctly based on the button's position that triggered it. It starts like this: <div id="popoverWrapper" class="popover-wrapper" style={...
5
votes
0answers
148 views

Architecture decision: use canvas app or lightning out?

Suppose we need to develop an app which can be used both inside Salesforce and in another web site. And definitely we don't want to duplicate the code. So basically there are two options here: ...
5
votes
1answer
894 views

I can't load PDF.js lib in Lightning Web Component

I'm creating an lwc component that shows a pdf with canvas, the lib I'm using is this:PDF,js when trying to load lib, returns me an undefined error, can someone help me how to load correctly My Html ...
5
votes
1answer
267 views

UI API within LWC as an ISV. What should be the approach when wire adapters are not feasible?

I have a lightning web component that needs to call UI API. I can't use the LWC wired adapters because the 'getRecordUi' does not take the "childRelationships" parameters like the 'record-ui' endpoint ...
5
votes
0answers
625 views

My LWC test is not displaying code coverage

I have configured jest for Lightning web component test. My tests are running and passing but code coverage not displaying into output. Following is package.json file: - { "name": "my-...
5
votes
1answer
948 views

event.getSource() alternative in LWC? (considering origin reparenting)

Consider below component chain in Aura: <c:parent> <c:child> <c:grandChild> When grandChild fires event, we can get hold of the source component by using event....
5
votes
0answers
471 views

lightning-record-edit-form component not being record-type aware

I wrote a lightning web component that includes a lightning-record-edit-form component. We are using PersonAccounts here and there are 2 RecordTypes on PersonAccount as well. The Type__c field is a ...
5
votes
0answers
613 views

Lightning Web Components: Set scroll position on lightning-datatable based on 'key' field value

We are looking to auto-scroll the user to a specific point in a lightning-datatablewhen a button is clicked. Assuming we referenced the key-field attribute data-row-key-value in the dom then in HTML ...
5
votes
2answers
2k views

Property value is not refreshing on Template when its Non-Primitive type

I am trying to update value of property in Parent Component which is pass in Child component. But after update value is reflecting in child component'c class (.js) but not in view (.html) Is it ...
4
votes
0answers
39 views

Is the time-zone attribute broken in lightning-formatted-date-time?

Based on my reading of the documentation that includes statements like this: When using the component to display a date only, without time, include time-zone="UTC" to ensure the correct ...
4
votes
0answers
39 views

When will ::part be available and will header cells in lightning-datatable be allowed for overriding?

I am specifically asking about the answer provided here We have many projects which have community implementations. As it is well known that communities tend to have their own themes and styles, the ...
4
votes
0answers
132 views

Lightning Map(Lwc) is not working on playground and documentation demo

Lightning map demo from the LWC documentations is not working. I am getting the below error. Unable to resolve forcehelp/linkToNonSalesforceResource from api/runtime/lwc-components/1.5.6-alpha/...
4
votes
0answers
150 views

Why can't I skip LWC namespaces in namesspaced scratch org

I have an LWC component as part of a managed package. To support Classic its also embedded inside VF page using a Lightning App(Aura): <apex:page standardcontroller="Account"> <apex:...
4
votes
0answers
148 views

Multi language support in community built using LWC (Migration from Visualforce to LWC)

We have an Identity community which supports more than 50 languages built using visualforce pages. We would like to migrate the community to LWC. For that, main issue we are facing is the language ...
4
votes
0answers
281 views

LWC @wire order of execution not working for ie11

I have implemented a lightning web component (lwc) that shows a dependent picklist field To load a dependent picklist in lwc I use @wire with getPicklistValues and because getPicklistValues requires ...
4
votes
2answers
431 views

How to @wire an external Rest API call with LWC OSS?

I have created a basic project and simply want to pull a list of greetings from Google Firestore instead of using the default static array of greetings. My greeting.js file looks like this: import { ...
4
votes
0answers
411 views

lwc getFieldValue from a custom external object

I am creating a LWC that handles data from an external object. I have access to the recordId through @api recordId;, but I need to get the externalId from this object as well. Currently, I have call ...
4
votes
0answers
3k views

NoErrorObjectAvailable Script error. Salesforce LWC

[NoErrorObjectAvailable] Script error. We trying to update the record data dynamically. we are sending the data from child to parent. We are trying to update the JSON object based on dynamically key ...
4
votes
0answers
131 views

Warning when setting input value in test

I'm writing unit tests for LWC using lwc-jest but when I try to follow the pattern documented in the Basic Lightning Component section of this documentation https://developer.salesforce.com/docs/...
4
votes
1answer
228 views

Lightning Radio/Checkbox option level helptext

Just wondering if it is possible in LWC to provide help text at a option level for radio-group or checkbox-group? We are wanting to provide further details about why a user might select each option. ...
4
votes
0answers
229 views

Jest Unit test an event that dispatches inside XMLHTTPRequest (XHR)

How do I test an event that does an XHR request and dispatches an event? I managed to install the dependencies to mock the xhr using https://github.com/jameslnewell/xhr-mock/tree/master/packages/xhr-...
4
votes
1answer
152 views

Lightning Web Component Slots in App Builder

Need some help, not even sure if this is possible... In Lightning App Builder, the standard tabs component has "Slots" where tab content can be placed. My question, is this available for LWC through ...
4
votes
0answers
662 views

Does ui:scrollerWrapper have an equivalent in Lightning Web Components?

Using slds-scrollable class in Lightning Web Component works in desktop browser but not on Salesforce Mobile app. For Aura components you would use the ui:scrollerWrapper to accomplish this. I've ...
4
votes
0answers
1k views

Unable to resolve custom label in lightning web component

With reference to the document Access Labels for lwc, I created few custom labels and used them in my web component; most of the labels were unable to resolve. I don't understand why exactly. To ...
4
votes
0answers
2k views

Error while loading a js as static resource in lightning Web component

I have a static resource name KendoUI, which is a javascript and is public. In my application, I have this : import { LightningElement } from 'lwc'; import { loadScript, loadStyle } from 'lightning/...
4
votes
0answers
392 views

LWC: Add a region in custom community theme

I would like to add a region in my custom community theme. For now I am only able to add my LWC components in the body area and would like to know how I can declare regions in my theme to accept LWC (...
4
votes
1answer
479 views

Dynamically accessing iteration item properties in a Template iteration on lightning web component?

I would enjoy using the easy to set up lightning-datatable, but it just lacks any ability to really customize it. It would work, but I need text-wrapping in cells instead of truncation. And it lets ...
3
votes
0answers
34 views

LeaftLet map is not loading in LWC

I have a simple leaflet map in LWC, libraries are loading successfully, however, the map is not rendering. Am I missing anything wrong? <template> <div class="map-root" lwc:dom=&...
3
votes
1answer
64 views

dragable div element in LWC

below HTML and JS I have written by going through some documentation on drag event. Not able to save anything on LWC playground so posted all code below which renders as shown in the below image. ...
3
votes
1answer
59 views

lightning-record-edit-form: display text field as a custom picklist?

I've created a custom object where the user manually enters a locale value (ex: en_US, es). Instead of letting the user manually enter a locale, I'd like to provide the user with a combo box of valid ...
3
votes
0answers
46 views

sfdx force:source:push error Push Failed. [XML parse error]

I created lwc for embbeding in Community and push it to a scratch org by using the command "sfdx force:source:push" but I got the error: Error parsing file: LWC Metadata Xml Parser: ParseError at [...
3
votes
0answers
101 views

LWC-base-components-recipes issue, Summer 20' release, assert.js

I am using textarea base component, this had to go with lots of other dependencies to my org. Unfortunately after summer 20' release I had to comment out code in assert.js today: export function ...
3
votes
1answer
54 views

LWC -Get PicklistOptions based on the RecordTypes

Let's Consider I have One Picklist Field, based on the RecordType the picklist options are there. I am using lightning/uiObjectInfoApi to get ObjectInfo in that I will get a list of RecordTypeInfos -...
3
votes
3answers
151 views

LWC Navigation Mixin not replacing current page?

When i try to navigate to a webpage it's loading in a new page. I want to replace current page url with the navigation URL. It' not working with below code. can anyone tell how to replace current page?...
3
votes
0answers
86 views

Platform event API name imported in LWC uses “c” instead of “e” as suffix?

I'm trying to make a component in a managed package to subscribe to a certain platform event, and referencing the channel with its API name previously worked: import BATCH_EVENT_NAME from '@...
3
votes
0answers
101 views

Lighting Data Table with large data set lagging on chrome browser

So I have this requirement to show folder and report as a hierarchy in LWC (used lightning tree for the same with custom icons for folders and reports.) and on click of any report, we fetch the report ...
3
votes
0answers
223 views

Detecting change on Record in Lightning Web Component withing Communities

I am looking for a solution to a basic scenario: A User in a Community submits an Opportunity, this Opportunity is enriched with data synchronously upon insert and asynchronously through ...
3
votes
0answers
543 views

Setting a max height for datatable in LWC?

I know when you specify a div with a height around your datatable you get a nice scrollable table: <div style="height: 300px:"> <lightning-datatable various-params></lightning-...
3
votes
0answers
91 views

LWC datatable multiple row actions open at same time

Experiencing this issue above. The error is when I click on many row actions it won't close the previous one and then you will have many open. I'm trying to find a solution to close all and open the ...
3
votes
0answers
194 views

WebSockets and Lightning Web Component

I'm attempting to use the JsSIP library to build a softphone with LWC. I've created the CSP records for my websocket server, but I still can't connect for some reason. Every time it attempts to ...
3
votes
0answers
122 views

Pass data to web component (angular 6) inside LWC (Lightning Web Component)

I have Angular 8 app defined as web component and I have Lightning Web Component (LWC) app. Inside LWC I am trying to pass data into web component through the property of DOM element like this....
3
votes
0answers
197 views

Highlight modified fields in LWC

I have a complex UI that renders multiple <lightning-input> fields. When the user edits these fields, I store the originalValue (usually passed through an @api property), the newValue and the ...
3
votes
1answer
245 views

Having Trouble Setting Up ESLint on IntelliJ IDEA (LWC)

I used npm init to create a package.json file on the root of my project, I then installed locally: npm install eslint babel-eslint @lwc/eslint-plugin-lwc --save-dev npm install eslint @salesforce/...

1
2 3 4 5
24