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
1
vote
1answer
816 views

Dynamic UI based on Large JSON response / Web UI based on JSON Schema implementation [closed]

I'm dealing with a complex problem and need expert opinion for selecting a right approach. In short, Need to render a Dynamic UI based on JSON returned by an external system. Each user selection ...
4
votes
1answer
1k views

What are these '@' symbol things in Web components [api, wire]?

While understanding code snippets provided by Salesforce. There are a few things which were confusing. Like what is @api, @wire. I googled for them, came to know they are called decorators. ...
1
vote
1answer
2k views

How do I handle caching for browser back button in lwc

I am building a multi-step webform for users to fill out for an application. This will be an unauthenticated public page. I was hoping to get some guidance on which storage to us for caching data ...
2
votes
1answer
474 views

Use Salesforce LWC Classes as User Interface Classes

We have a requirement of having some template in which we can inject the components dynamically with dependency injection at runtime using configuration. We are exploring the LWC for this since it's ...
7
votes
1answer
921 views

LWC SFDX source push error TypeError: LWC1009: decl.moveTo is not a function

Getting a strange error while running the sfdx force:source:push command for an lwc component PROJECT PATH ERROR ──────────── ───────────────────────────────────────────────── N/A ...
4
votes
2answers
3k views

LWC RecordTypeInfos via getObjectInfo Unable to access

I am following a guide for how to get a specific record type for when creating a lightning-record-edit-form and I am getting this error thrown: My Html looks as follows: <lightning-record-edit-...
4
votes
2answers
6k views

LWC download PDF file

I use LWC components in Customer Community. There is datatable component with records and I implemented the function to export selected records in .csv and .pdf. csv works fine, but I experience the ...
1
vote
1answer
1k views

Call UI uiObjectInfoApi dynamically

uiObjectInfoApi is quite nice in LWC but is there any way it work based on attribute; so that its more dynamic. Scenario: Object API name is passed from parent to child component which uses it to ...
4
votes
1answer
5k views

Display Radio Group horizontal in LWC [duplicate]

I'm trying to display Radio Group horizontally in lwc, but it seems to be not applying my custom css. HTML: <template> <lightning-radio-group name="radioGroup" ...
2
votes
1answer
2k views

Table row LWC breaking SLDS styles

Situation I'm building a table row LWC to separate and encapsulate some logic like so: <!-- tableComp.html --> <table class="slds-table slds-table_cell-buffer slds-table_bordered"> &...
0
votes
0answers
117 views

Unable to rerender a lightning component once the apex method is called

I'm building a lightning component using the new Lightning Web Component framework, the component retrieves information from a custom setting with three checkboxes, once the user changes the values of ...
0
votes
2answers
2k views

Wrapper of wrapper in LWC

I'm trying to use wrapper of wrapper in my lwc but while accessing the wrapper attribute, its not displaying any value. I checked in my controller before the return statement and it is returning data....
3
votes
1answer
9k views

Calling apex imperative method in lightning web component needs two click to show data

I have an apex method that has an attribute and calls a web service: @AuraEnabled() public static string getDetailEta(Integer idE) { system.debug('>> getDetailEta '+idE) ; ...
2
votes
1answer
797 views

Lighning Web Components : Passing Javascript string var to HTML href tag

I am trying to bind static url with parameters from Javascript and its not working. Tried several variants <lightning-tile label={option.label} href="https://www.google.com/search?q={option.label}"...
0
votes
0answers
662 views

change background color of lightning tab LWC [duplicate]

LWC don't allow to change color with css and there document guide don't say anything about this ? https://developer.salesforce.com/docs/component-library/bundle/lightning-tab/documentation Can ...
0
votes
1answer
65 views

I am facing sfdx: Autorize a dev hub failed to run

how to solve this problem, I also tried powershell also i can't found any solution.
3
votes
1answer
2k views

Is it possible to fire an event from a LWC and handle in another LWC which is not in containment hierarchy?

Is it possible to fire an event from a lightning web component and handle in another lightning web component which is not in containment hierarchy? This is achievable in Aura component using ...
1
vote
0answers
2k views

How to set default value for a select in lwc [duplicate]

Regarding the following code: <div class="slds-select_container" title={line.record.Order_Line_Status__c}> <select class="slds-select" value={line.record.Order_Line_Status__c}> ...
3
votes
1answer
3k views

Third-party js lib (jQuery + DataTable) not being loaded in LWC [duplicate]

I was trying to create a new LWC importing a third-party library that we already used in the past with VF but within a LWC. We decided to use this one instead of lightning-datatable because we need a ...
1
vote
1answer
549 views

getListUi returns old list view

I am using following LWC wrapper in aura to get list views: LWC: import { LightningElement, wire, track, api } from 'lwc'; import { getListUi } from 'lightning/uiListApi'; export default class ...
5
votes
2answers
9k views

How to use Wrapper Class in lwc

I'm trying to use wrapper class in lwc, but getting one error "Uncaught afterRender threw an error in 'c:wrapperComponent' [Cannot read property 'Id' of undefined] Callback failed: aura://...
2
votes
1answer
8k views

Lightning-Web-Components Select Option prepopulate value

Let's say I have a Lightning-Web-Component with a select list with dynamic options where the value is a user Id and the label is the user's name: <select class="slds-select" onchange={...
6
votes
1answer
3k views

Composed Lightning Web Component with slots and conditional rendering

Use Case I'm building a LWC to use as a modal template (leaving a slot for the body) so all the logic from the modal can be handled there and reuse it for multiple modals Example Here's the ...
1
vote
1answer
5k views

LWC lightning-button-menu alignment

I use lightning-button-menu component and would like to align the menu top. I found that it can be aligned left or right, but it there a possibility to align top? <lightning-button-menu ...
1
vote
0answers
63 views

is element validity object is extendable?

I want to extend element.validity, so that can add more custom error type in that. Tried many ways to copy or deep copy and Object.create element.validity but seems like its not possible ... @api ...
3
votes
1answer
5k views

Lightning Web Components inline editing Datatable - data update issue

I am starting with Lightning Web Components and I've tried to use data table. For some reason I can see data being changed in table - but in js controller my variable remain unchanged. js import { ...
3
votes
0answers
107 views

Able to Modilfy @API in compone.js in Lightning Web Component

As per documentation at https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.js_props_public which states A component that declares a public property can set only its ...
7
votes
1answer
6k views

How do I fetch the one field value using Lightning Web Components?

Context I am looking to store and auth token in a custom field for each Salesforce users. I read this post and consider the custom field to be suitable for my needs to store an auth token. There are ...
2
votes
1answer
977 views

Using third-party Web Components with Lightning Web Components

Is it possible to use third-party standard Web Components with Lightning Web Components? I have seen the documentation about third-party libraries. But what about web components? Has anyone tried to ...
3
votes
1answer
733 views

"Invalid value" in property inside App Builder with custom Lightning web component

I'm building a component where I want my user to select the pricebook he wants from a picklist. By following the guide on how to build those dynamic properties, I ended up with the following Apex ...
2
votes
2answers
3k views

Change handler equivalent in Lightning Web Components

I recently started looking into Lightning Web Components. Initially, I assumed that track decorator also acts like a change handler, But looks like I was wrong about it. Is there any functionality ...
1
vote
2answers
1k views

When adding a wire method into lwc I got error on page

I did some small changes based on the lwc-recipes, apex series. But I am getting an error telling me e[ki] is not a function, which is obviously from some library code. And I find it hard to debug ...
3
votes
2answers
954 views

Lightning Web Component - do I need to track changes for every single input field in a form

Since lwc is one-way data binding so if I need to get the current value of the input field I turned out to use event.target.value in the onchange event. However, if we need to have a form of input ...
1
vote
0answers
351 views

How to get lightning-table column width in an aura wrapped LWC

I have a LWC that is wrapped in an aura component. I have been spinning my wheels for a few days on trying to access the attributes of the lightning-datatable after it's been loaded, specifically the ...
5
votes
0answers
787 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 ...
1
vote
1answer
3k views

How to handle Lightning Web Component Event from Lightning Aura Component?

I am firing an event from my Lightning Web Component(LWC). Now I have to receive this event by a Aura Component. As per the documentation I am able to receive the event if this LWC is enclosed in the ...
2
votes
1answer
296 views

Consume LWC's getListUi wire in Aura component

I want to grab list views in Aura by sobjectType and list view name. I already made a component that does a request, but fail to expose the data to Aura. Attribute change handler never fires and upon ...
1
vote
1answer
1k views

Error when adding different Lightning Web Components to the Playground

I'm using the Salesforce LIGHTNING WEB COMPONENTS PLAYGROUND to build a prototype in LWC: https://developer.salesforce.com/docs/component-library/tools/playground/ However when I add an additional ...
5
votes
1answer
2k views

lightning-datatable row number error

I have a lightning web component, using lighting-datatable with row-numbers visible. This works well up to 99 records... then I get this: [![enter image description here][1]][1] My component code: ...
0
votes
0answers
95 views

Using refreshApex on button click in LWCs? [duplicate]

I have a save and a cancel, both triggered by a button click: saveCriteria(){ let criteriaToSave = []; //reassemble drill up/down fields on the criteria for(let i = 0; i < this....
1
vote
2answers
1k views

What are the limitations of number of Rows that can be returned in an Aura Enabled APEX Method?

I keep reading conflicting answers about how many rows an SOQL query can return in an APEX method. Some say 200, some say 2000, some say 50,000, and some say 1 million (read only). I am looking for ...
1
vote
0answers
1k views

LWC NavigationMixin does not work in Community [duplicate]

I use NavigationMixin.Navigate for redirection to external sites. It does work in Lightning App (internal SF) but does not work in Community. Here is the code: class definition: export default class ...
2
votes
1answer
770 views

Waiting for results from APEX call in a for loop

I need to load a number of records more than the 2000 default limit for an SOQL query, but I need to wait until all of them are loaded before moving on. To do this, I make a request to get the total ...
2
votes
0answers
169 views

Why we have two data model static and dynamic in lwc to refer in metadata aware component

In base lightning component in LWC we can refer data model static or dynamic. Static ensures referential integrity whereas dynamic does not. Is there any other difference between these two? Which ...
8
votes
2answers
11k views

In LWC, how can I make a lightning-button use the full width available to it? [duplicate]

I have built a form using lightning-record-edit-form & have added a button to it using lightning-button. I want the button to have 100% width, so I added a class to lightning-button that sets ...
3
votes
2answers
12k views

How to Add LWC to lightning App Builder

I created one simple LWC component and when I tried to add it in Lightning App Builder I'm not able to see it. So how to add LWC in lightning app builder.
0
votes
1answer
271 views

Lightning Web component is not getting deployed from Source to Org

Lightning Web component is not getting deployed successfully from Source to Org. Screenshot of the error:
11
votes
1answer
4k views

Why it is forbidden to import several Apex Methods at once in LWC module?

I have Apex Controller Class, say, LWCController and several methods inside of it, let's say Method1, Method2, Method3, Method4, Method5. Documentation says that to Use default import syntax to ...
0
votes
0answers
143 views

refreshApex on Account detail page change [duplicate]

I have a lwc component that used apex controller on account page when the account updated, my component is not refreshing with latest data updated on account. Is there any listener available in lwc? ...
0
votes
2answers
377 views

Multiple Web Components for one Project, Visual Studio

When attempting to create multiple Web Components through VSCode, do you have to create multiple projects, or can you have one project with multiple components?