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.

Filter by
Sorted by
Tagged with
0
votes
1answer
19 views

How to send flattened data from Javascript file of LWC to Apex method?

I get data from a wrapper class and flatten the data in JS file of my LWC as follows: @wire(getAccount, { id: '$recordId' }) wired(result) { this.refreshTable = result; if (result....
3
votes
1answer
27 views

Recommended approach when LWC Base component is missing feature

I have a nice LWC component which is using lightning-datatable but I also need InlineEdit for those two types which are currently not supported. Lookup Field Picklist Field Option A: I could use the ...
0
votes
2answers
30 views

Owner name is not getting populated in LWC by using @wire decorator

XML file: <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="partnerOpportunityRecordRead"> <apiVersion>47.0&...
0
votes
1answer
22 views

Reactive property in @wire notation from other @wired method

DISCLAIMER : I know there are better ways to get the current User Id, I am just writing this up as example to illustrate the issue I am facing. Let's say I have two apex methods that are @AuraEnabled ...
-3
votes
1answer
33 views

Saleforce LWC websocket [closed]

Can anyone help with a sample solution for Saleforce LWC websocket? import { LightningElement } from 'lwc'; export default class Websk extends LightningElement { let connection=new WebSocket("ws://...
7
votes
0answers
26 views

Testing LWC with multiple @wire getRecord calls with Jest

I thought this would be straight-forward, but it turns out to be a complete nightmare. Found no help on google, in the lwc-recipes or documentation. Here's my issue: I have a LWC that makes multiple ...
0
votes
1answer
28 views

Lightning-combobox not showing any value sometimes

I have intermittent problem on my lwc whereby some user not able to see the values when clicking the picklist value (lightning-combobox). When I login using system admin, I also have the same problem ...
1
vote
1answer
51 views

Reset the lightning-input to its default value

Problem - I am not able to reset the lightning-input to its default value. What I want - I am providing the default value to lightning-input through my javascript file. I change the values of ...
2
votes
1answer
69 views

Afterrenderer error in LWC as wired method return undefined the first time

I recently moved from Aura to LWC and not able to understand whats going wrong here. Below sample code lwcpage.html <template for:each={names} for:item='name'> <div key={...
-1
votes
2answers
38 views

afterRender threw an error in 'c:componentName' [Maximum call stack size exceeded] in LWC

I was playing with getter and setter in Lightning Web Component and ended up with below code:- @api get itemName() { // eslint-disable-next-line no-console console.log('@@ this....
0
votes
0answers
21 views

Character length in lightning-output-field in LWC [closed]

I am using 'lightning-output-field' for the account details field. Now I want to display that field collapsable when char limit is more than 50.
0
votes
1answer
35 views

Use LWC component directly for community Registration

I have created a custom LWC component for customer registration for community portal. But there are no options to select LWC component in the Registration Page Configuration. So that I have added ...
0
votes
1answer
25 views

How do I change the theme of a record page to have a gradient background?

I want to setup a gradient background and not use the themes that are available with SF. I tried creating a new theme where it takes a background image but that is shown only in the top of the screen ...
0
votes
0answers
16 views

Popup backdrop is not showing blur when LWC is invoked from VF Page.It works fine when invoked directly without VF page

I am invoking LWC from VF page and showing popup with list of contacts.Issue is Popup backdrop is not showing blur like how it opens when we invoke LWC directly.As it is lightning behaviour I believe ...
1
vote
0answers
38 views

On button click it should scroll to top in salesforce1 with LWC

async ScrollToTop() { var scrollOptions = { left: 0, top: 0, behavior: 'smooth' } window.scroll(scrollOptions); } This works on PC but ...
0
votes
1answer
29 views

Error in Lightning Web component :afterRender threw an error in 'c:lightning' [Cannot read property 'data' of undefined]

Below is my code for Lightning Web Component: HTML File: <template> <template if:true = {files.data}> <template for:each={files.data} for:item='file'> <...
0
votes
1answer
25 views

LWC Custom file-upload without file size limit 4Mb

Does anyone know the way to write custom file-upload on lwc based on html input and file size limit at least 20Mb?
1
vote
0answers
18 views

LWC eslint rule [closed]

I am in VSCODE and trying to set eslint rule for LWC using https://github.com/salesforce/eslint-plugin-lwc I am unable to set it up properly and lint rules are not firing. Can anybody help me here who ...
2
votes
0answers
30 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
1answer
36 views

Use field of type Time in LWC

I'm trying to display the value of a field of type Time in a LWC. The point is that from the Apex class I'm receiving an integer number instead of the standard time format string. Here an example: I ...
1
vote
1answer
27 views

lightning-input: what is the purpose of message-when-too-long?

The lightning-input component has a documented property, message-when-too-long, which is described as: "Error message to be displayed when the value is too long." in the documentation. Presumably, ...
0
votes
1answer
62 views

why @track list doesn't rerender after value is changed?

i have a list of sobject that is retrieved from the db thanks a call to an apex method tha return the list, the list is retrived async with a the setInterval function . //this is the sample of the ...
0
votes
0answers
24 views

Lightning Web component (LWC) Angular App static resource

Running into the issue of invoking Angular App (which is static resource) inside the LWC. What is the right way of invoking static resource application from LWC? Can someone please share an example? ...
1
vote
1answer
71 views

Why the AuraEnabled method throws an internal error when a namespace is enabled

We used nested classes in LWC controller to have a single class with all the AuraEnabled parameters. That works in a no-namespace environment but stops working when we either package that or deploy to ...
0
votes
1answer
36 views

Passing property to LWC component

Trying to pass a default value to an @api decorated property, somehow I get undefined variable, here is my code meta.xml <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle ...
0
votes
2answers
37 views

How to pass value to date parameter in apex method from LWC JS?

Please provide a proper way to call this method from LWC passing date parameter. public with sharing class ApexClass { @AuraEnabled(cacheable = true) public Date string apexMethod(Date z) { ...
0
votes
1answer
47 views

Not responsive height in LWC [closed]

do you know if it is possible to express the height of a specific LWC in %? I want to make it responsive, actually when I try to set an height like : height: 100% it seems that the attribute is ...
2
votes
1answer
51 views

Lightning-input currency not working properly as of Spring 20'?

Hi I refreshed my org in order to have the latest changes from Spring 20' release, and I noticed a change in the input type currency when I try to type the decimal value separated by a dot ('.'), it's ...
1
vote
1answer
30 views

Is there a way to invoke a function when error occurs in lightning-record-edit-form in LWC

I would like to know if I can set a handler function so that it will be invoked when errors occur while submitting a record-edit-form in LWC. By errors I mean, required field errors. 'onerror' event ...
0
votes
0answers
19 views

ESLINT_ERROR: Parsing error: Identifier directly after number Error during conversion of javascript button to Lighrning

I have a Salesforce onClick Javascript button that I am trying to convert to Lightning using the Transition utility. When I click Convert on this button, I get the following error: (Even though it ...
0
votes
0answers
19 views

Opening a Report with a Lightning Web Component

I am trying to write a lwc that will allow users to enter a reporting url and and choose 2 parameters from a combo-box. Based on their selection, I'm trying to pass the parameters to a report url. I ...
0
votes
1answer
32 views

Issue with lightning web component array sort

I have an array I use for a paginated list in a dynamic table inside a lightning web component. I'm trying to get the sort function working to adjust the data based on which column is clicked, but I'...
0
votes
0answers
23 views

How to update values on server with Lightning Component?

How can I get values selected on a drop down by a user to save to the records? I believe my issue is in my JS controller "changeDcn".. Component <!--massUpdateItemDecision--> <aura:...
5
votes
1answer
309 views

Retrieving Metadata from Org using VS Code and CLI results:- MaxListenersExceededWarning: Possible EventEmitter memory leak detected

I am seeing a new warning message when retrieving metadata from VS Code. The metadata retrieval is successful but also getting below message. Steps to reproduce:- I have created a Lightning Web ...
0
votes
1answer
27 views

Custom lightning component disappears without errors in log, when button clicked, but only in production

I have the same lightning-button-stateful onclick event handler in the sandbox and in production. _handleSectionExpandCollapse(event) { let content = event.target.parentElement; event.target.selected ...
0
votes
0answers
24 views

URL or link to call lightning component with Parameter(ID) in Salesforce1 app

So I have a lightning web component and now I want to call my lightning web component from url so that it should open in salesforce1 app with parameter as recordId. How can I do this? Thanks
0
votes
0answers
16 views

LWC datepicker not supported locales

LWC date picker not supported certain salesforce locales. This problems occurred in Spring 20. For example if I set English locale it works fine, and date picker is displaying, but if I set Belarusian ...
0
votes
1answer
50 views

Download file in lwc

I'm receiving a link to a file once the component is loaded, and i want to download it. html <template> <lightning-card> <div class="slds-align_absolute-center" style="...
0
votes
1answer
33 views

How to pass parameter in click events. Like done in other frameworks(angular,reactjs etc..)

I want to pass parameter in click events, how to do in lwc. suppose there is a list of objects in template iteration and click I have to send a single object. How to do??? Please find below the ...
0
votes
0answers
19 views

Can we set and get @API value for managed package components?

While we create the managed package and import that with another ORG, we can't pass the dynamically values to that components. in other hand, same will be working as expected with unmanaged package. ...
0
votes
1answer
34 views

Open a custom object from a click on the LWC page [closed]

I'm trying to open a custom object from a click on the LWC page. Using the html below I get the expected icon and can click on it getting the console.log() in the js below. And if I hardcode the ...
0
votes
1answer
26 views

lightning-record-edit-form look up filter

<lightning-record-edit-form object-api-name="Contact"> <lightning-input-field field-name='AccountId' value="xxxxx"></lightning-input-field> <lightning-input-field ...
3
votes
0answers
48 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 ...
0
votes
0answers
28 views

Switch between custom tabs on lightning record page with JavaScript

I have two custom tabs on a record page. Both contain a custom lightning web component. I'd like to switch between the two tabs with JavaScript. Is this possible?
0
votes
1answer
51 views

Override Standard CSS in LWC [duplicate]

Is there any way to override the standard css provided by salesforce in LWC? I tried the way we did for aura components but it doesnot seem to affect the structure in any way. Do we have different ...
0
votes
2answers
42 views

Change the color of Lightning-input label

I have below code for input text <lightning-input label="Email" class="textInput" value={rec.Name} onchange={handleNameChange}></lightning-input> Here I want to change the color of the ...
2
votes
1answer
39 views

lightning-record-edit-form not displaying help text in community

<lightning-record-edit-form object-api-name="Account"> <lightning-input-field field-name='Name'></lightning-input-field> </lightning-record-edit-form> above peice of ...
0
votes
1answer
43 views

CSS for <lightning-input type=“checkbox” > is not working in LWC

I have the below div inside my LWC html. <div class="container-fluid"> <div class="slds-size_1-of-2"> <lightning-input label="First Name"...
2
votes
1answer
39 views

Is it possible to dynamically create LWC from aura component?

We can't dynamically create LWC like aura does. We can embed LWC in aura, is it possible to dynamically create LWC using $A.createcomponent within aura component?
2
votes
1answer
22 views

Unable to resolve force/lds from api/runtime/lwc-components/1.3.0-alpha/src/lightning/uiRecordApi/uiRecordApi.js

HTML <template> <lightning-record-edit-form object-api-name="Contact" onsuccess={handleSuccess}> <lightning-messages></lightning-messages> <div class="slds-m-...