Skip to main content

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.

2,651 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10 votes
2 answers
2k views

How to force cache refresh on community when releasing to production?

We have a community composed of multiple LWC. We are planning to release a big update in our production environment. When testing in other environments, some testers who had used the community ...
Sacha Dieryck's user avatar
8 votes
2 answers
4k views

How to dynamically import a module in lwc

I am trying to import modules dynamically in my LWC component. While pushing the change I get a strange error LWC1509: This experimental syntax requires enabling the parser plugin: 'dynamicImport' ...
Anmol Kumar's user avatar
  • 3,631
8 votes
2 answers
2k views

Event propagation with bubble true in LWC

I'm trying learn event propagation in LWC. As per the documentation it says {bubble: true, composed: false} means the event does not cross the shadow boundary, but it bubbles up the shadow boundary. I ...
Ranjith U K's user avatar
7 votes
1 answer
840 views

Declaratively mocking a custom LWC in a single unit test

The approaches suggested of using jestconfig module mapper or the mocks folder work well if you have a single mock per component you are testing, but not if you have to build how your parent component ...
Edmondo's user avatar
  • 1,712
7 votes
4 answers
5k views

You can’t remove the following public properties because the component is part of a managed package

I am trying to push a JS file in a LWC Component and am unable to do so with this error lwc/boatMap/boatMap.js-meta.xml: You can’t remove the following public properties: boatId, because the component ...
Badduboy's user avatar
  • 111
7 votes
1 answer
2k 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. ...
Tony White's user avatar
6 votes
0 answers
2k views

How to refresh LWC component using getRelatedListRecords when related record edited

I have a component rendering a list of records related to the record on which the component is displayed using getRelatedListRecords (Beta). //Get Related List Records Info @wire(...
MooseAteJack's user avatar
6 votes
0 answers
1k views

How to disable lightning locker service by default in community

I have an lwc component to display charts using chartjs library in the community. The component was working perfectly in internal salesforce but the chartjs library failed to load in the community. By ...
Anmol Kumar's user avatar
  • 3,631
6 votes
0 answers
386 views

How to correctly enable Type checking in VSCode for LWC?

I wonder how to sucessfully configure type checking in VSCode for LWC. VSCode has JS/TS compiler that support type checking when we set jsconfig.json with compilerOptions like below: "...
Grzegorz Połuch's user avatar
6 votes
1 answer
1k views

Can I get all existing Pages for a Community using Apex?

I would like to create a custom component to use in Experience Builder, and this component will allow a configurable navigation to another page. I would like to use a dynamic picklist with Apex to get ...
Fabien Taillon's user avatar
6 votes
0 answers
662 views

Neither forceCommunity:routeChange or aura:locationChange cannot detect the URL change with history.replaceState

We have a use case where a lightning component built in LWC, should trigger a URL change. We're handling that with the history.replaceState method(note that we encountered the same problem with ...
Endrit Sino's user avatar
6 votes
0 answers
2k 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 ...
Robs's user avatar
  • 9,376
6 votes
0 answers
985 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 ...
mmm321321's user avatar
  • 659
6 votes
0 answers
1k 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 ...
Ed Elliott's user avatar
6 votes
2 answers
4k 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 ...
Mekyush Jariwala's user avatar
5 votes
0 answers
8k views

Recommended way to pass data to between LWC and Apex

In the documentation for LWC, Expose Apex Methods to Lightning Web Components, the note says: You can’t use an Apex inner class as a parameter or return value for an Apex method that's called by a ...
Raul's user avatar
  • 18.8k
5 votes
0 answers
669 views

reCaptacha in iFrame LWC Lightning Out - external website

I am trying to use reCapatcha in LWC using iframe, it works fine on the lightning record page, however the same component I am using on an external website using lightning out. The iframe is refuse to ...
Ajay 's user avatar
  • 1,599
5 votes
0 answers
982 views

Remove default LWC Tooltip "This property supports using an expression to define its custom label"

In our organisation we have some LWC with configurable fields in the XML As you can see, some of them have description and others have not. Even for the ones that have a description, the help text ...
Luisma Whatakuai's user avatar
5 votes
1 answer
2k views

trying to build org chart using OrgChatJs in LWC

I am trying to build a Org Chart using OrgChatJS (https://balkan.app/OrgChartJS/Docs/GettingStarted) in LWC . It will look like this But in Salesforce , its coming a blank page. Anything i am ...
sfdc_to_learn's user avatar
5 votes
1 answer
1k views

Using third party javascript library in LWC without a static resource

My question is similar to this. It seems we need to upload the Javascript library as a static resource before we can use it in LWC. I've got a payment gateway JS library which I need to use via CDN ...
Pasan Eeriyagama's user avatar
5 votes
1 answer
3k views

Google Analytics Event Tracking in Community using LWC

I'd like to use Google Analytics Event Tracking inside a Community in LWC We have Google Analytics configured in Builder > Settings > Advanced > Google Analytics The documentation says to ...
Robs's user avatar
  • 9,376
5 votes
0 answers
2k views

LWC With iframe Height

I am trying to have an iframe inside a LWC fill the entire height of what's available, but can't seem to get it to work. According to the documentation, I think I should be able to apply class="slds-...
Daniel Hoechst's user avatar
5 votes
0 answers
717 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: ...
Lance Shi's user avatar
  • 13k
5 votes
1 answer
2k 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 ...
SBB's user avatar
  • 173
5 votes
0 answers
2k views

Importing lwc from managed package

I'm currently developing a managed package, with a LWC. From another package, I want to import this managed package in order to access some of the exported elements, like the class or some constants. ...
mnunezdm's user avatar
  • 909
5 votes
0 answers
905 views

Modal being rendered in wrong position on lightning web component's mobile page

What I want I'm trying to show a modal to warn the user when the service he is trying to reach is offline. This salesforce page is accessed by Salesforce1 through a tablet. How I did I've created a ...
Igor Santana's user avatar
5 votes
1 answer
1k views

LWCs - Navigation Menu Base?

I am in the process of building a custom navigation menu as a Lightning Web Component for my community. I know that in Aura Components one could use forceCommunity:navigationMenuBase, which provides ...
Andrew's user avatar
  • 191
5 votes
0 answers
3k views

LWC lightning datatable: Enabling Popover Overflow

I'm creating a lwc datatable with a custom column which contains a button and a corresponding popover. The problem is that the popover will not display as I would like it to, though by playing ...
thomnguyen's user avatar
5 votes
0 answers
2k 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 ...
Sebastian Kessel's user avatar
5 votes
1 answer
2k views

Is there a way to use a private custom lwc Component (isExposed=false) in a flexipage that will be deployed in a managed package?

We are an ISV partner and are working on a managed package that we will release soon. We are mostly using LWC components and found that if we try to include one of our custom LWC component into a ...
pdebaty's user avatar
  • 967
5 votes
0 answers
1k 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 ...
Dan Nicholson's user avatar
5 votes
0 answers
4k 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/...
Pankaj's user avatar
  • 51
5 votes
0 answers
9k views

Invalid reference of Static Resource in LWC Salesforce

I am trying to use Static resource inside the lightning web component. while importing getting this error:- "Invalid reference SDFCImages of type resourceUrl in file StaticResourceDemo.js" here how ...
Vaishali Garg's user avatar
5 votes
1 answer
3k views

LWC Datatable - Turn Custom Lookup Field Value in Editable Datatable to Draft Value for Mass Update

As you know, datatables do not support lookup field. I've built a search lookup field that queries an object, and added that to the LWC datatable as a custom type. The id of the selected record (...
Fred's user avatar
  • 51
4 votes
0 answers
39 views

Widening the popover for a lightning-datatable editable custom data type to allow a lightning-dual-listbox

The Make a Custom Data Type Editable documentation provides an example of an editable table cell custom type and that example works well. I'd like to use a Dual Listbox for one column in a table but ...
Keith C's user avatar
  • 136k
4 votes
0 answers
42 views

JAWS reading the error message twice in lightning input LWC

JAWS reads the error message on the lightning input twice, because of the presence of both aria-errormessage and aria-describedby attributes. Values for both attributes are the same. How to resolve ...
LoneWolf's user avatar
4 votes
0 answers
391 views

Refresh Standard Related List from ScreenAction LWC not working

I tried to use this.dispatchEvent(new RefreshEvent()) to refresh standard related list on the same page but not working after I close the quick action panel. Below is the sample code HTML <template&...
Channing Bie's user avatar
4 votes
0 answers
427 views

LWC: Building JS dependencies from NPM modules

To take advantage of NPM's audit, update, and other capabilities, I'm a firm believer that developers should use a package manager like NPM to manage JavaScript libraries that they import in their ...
Matthew Souther's user avatar
4 votes
0 answers
144 views

How to convert two same strings to the same unicode or code?

I have a string coming from the LocaleSidKey by using the toLabel method. We are using language translations: User currUser = [SELECT Id, toLabel(LocaleSidKey), Current_LOB__c FROM User WHERE Id = :...
karthik's user avatar
  • 39
4 votes
0 answers
4k views

LWC lightning-input Currency

In Lightning Web Components (LWC) the 'lightning-input' component supports a 'formatter' attribute which has value 'currency' and this displays decimal values with currency formatting, for example: 1....
John Lewis's user avatar
4 votes
0 answers
539 views

How run logic after NavigationMixin.Navigate completes

This code works great. this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: this.selectedObject, ...
Tom Ansley's user avatar
4 votes
0 answers
521 views

LWC Typescript this parameter type

defineProperties(Element.prototype, { querySelector: { value: querySelectorPatched, writable: true, enumerable: true, configurable: true, }, ...
Michael Munta's user avatar
4 votes
0 answers
418 views

NavigationMixin unavailable in lightning_FlowScreen

I have a lwc set up to take in a record Id, and navigate to the record I'm attempting to use in a flow screen. The controller code is below. The problem is the navigation mixin still seems to be ...
cmcgee1's user avatar
  • 41
4 votes
1 answer
1k views

Markup to present a spinner in a lightning-quick-action-panel quick action?

Now that quick actions can be created using LWCs, the lightning-quick-action-panel component makes consistent styling easy: <template> <lightning-quick-action-panel header={headerText}>...
Keith C's user avatar
  • 136k
4 votes
0 answers
1k views

Return Record Id of newly created Record After Using NavigationMixIn.Navigate

I have created a button in a custom LWC that when clicked, the below js runs. This opens the standard salesforce new record create modal and the user can then enter information to create a new record. ...
Tobi's user avatar
  • 41
4 votes
0 answers
2k views

[LWC][CSS]slds-backdrop is not covering full device height behind slds-modal in Salesforce mobile app

We are using slds-modal in our LWC, which is working fine in desktops and large devices. Means behind the modal we are showing the slds-backdrop screen and it covers everything behind the modal box to ...
Rohit Bhamdare's user avatar
4 votes
0 answers
104 views

How to handle Platform Event while UI is being rerendered?

Use case: We have Digital Experience (i.e Community) where at first we perform the action and after it, we redirect to a new page. This action also publishes Platform Event (Notification) which should ...
ytiq's user avatar
  • 4,555
4 votes
2 answers
611 views

How to replicate the functionality of delivered "File Engagement" lwc card?

In our org we have a need to programmatically replicate the functionality of delivered “File Engagement” component/card. Here is a snapshot from our live org, on a ContentDocument view page: Since ...
kivanconer's user avatar
4 votes
0 answers
2k views

Lightning record page printable view or PDF

I need to create a printable view (or PDF) of a record's Lightning Page (think "tear sheet") that includes a compact "details" section, compact related list tables, and a custom ...
Brent Bowers's user avatar
  • 3,144
4 votes
0 answers
521 views

Showing custom notification in Community | Theme : Build your own || Custom apex notifications

I want to show custom notification through apex in the community. Community is having custom theme(all lightning components). I know how to trigger apex custom notifications for the internal users. ...
Ysr Shk's user avatar
  • 3,157

1
2 3 4 5
54