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
votes
1answer
7k views

How to display image from ContentVersion object in Lightning Web Component [closed]

how can i display image coming from ContentVersion object in datatable using lightning web component
0
votes
1answer
351 views

aura:dependency migration to lightning web component

what would be the equivalent to <aura:dependency resource="c:lightningComponent" /> in Lightning Web components? I wonder if importing the class that holds the component logic would suffice ? ...
0
votes
1answer
1k views

Lightning Web Components, how to set lightning-input autocomplete="off" [closed]

I have a lightning-input with type="search". I am having trouble to set autocomplete="off" to be able to disable autocomplete functionality of modern browsers like Chrome. Any help on this is ...
6
votes
3answers
26k views

@track vs @api (Lightning Web Components)

Let's say we have this code for a LWC: <!-- helloExpressions.html --> <template> <div class="slds-m-around_medium"> <lightning-input name='firstName' label="First ...
4
votes
1answer
5k views

Not able to fetch custom field and Profile fields in LWC

I am not able to get User.Profile.Name and Case.Swap_Type__c field value but I am getting other field values. import { LightningElement,api,wire,track } from 'lwc'; import { getRecord,getFieldValue } ...
7
votes
1answer
481 views

Should I use Javascript Classes or Apex Classes in Lightning Web Components? [closed]

I am working on designing a timesheet Lightning Web Component for my company. Internally, we use a sObject that tracks individual sessions, which then gets rolled up one way to generate payroll, and ...
13
votes
2answers
23k views

How do I invoke a value change handler in LWC?

Is there a way in LWC to declare an attribute value change handler like there was in Aura? My use case is that I have a pager component which has 2 @api properties. When either of the @api values ...
1
vote
0answers
989 views

Date picker for web component [closed]

I'm trying to find a date picker for my custom web component. I've found Pikaday, which works outside of SF, but inside SF it loads fine, but when I click on the date field the calendar flashes up ...
2
votes
1answer
2k views

VisualStudio Code not getting option "Deploy Source to Org"

I am starting to learn LWC and trying to create the HelloWorld example as described in in trailhead. I have followed all the steps mentioned in the trailhead but I don't get the option SFDX:Deploy ...
0
votes
1answer
773 views

Wrap lightning-tab inside custom LWC

I wan't to offload tab loading (and separate concerns) from my lightning-tabset container. When I naively wrap my components I get errors which I find rather hard to parse. <template> <...
0
votes
0answers
64 views

Is it possible to hook a function every time an api attribute has been changed? [duplicate]

I have built a custom inputSelect component: <template> <div class="slds-select_container"> <select class="slds-select select-input" data-rea={reatag}> <...
6
votes
1answer
1k views

Is it possible to implement nested modal in lwc

I am trying to implement nested modal dialogs (modal in modal) in lwc. Have tried a few but the result doesn't seem to be awesome. In react, there seems to be some library for layering. But I don't ...
0
votes
1answer
1k views

Implement three state checkbox using LWC

I am trying to implement a tri-state checkbox using LWC input type=checkbox element and I am trying to set HTML 5 indeterminate attribute https://html.spec.whatwg.org/multipage/input.html#checkbox-...
2
votes
1answer
134 views

Update sObjects in .sfdx/typings

I have a VSCode SFDX Project that we use to develop LWCs, and we recently changed some object names in the Org and now I can't upload anything to our Org. I found that there is a command to refresh ...
0
votes
1answer
3k views

LWC: Anyone managed to get a Datepicker/calendar JS library to work in LWC? [closed]

I have tried 3 libraries now - datepickk: doesn't load - FullCalendarJS: the main libray loads and works but NO plugin could be loaded so useless - lightpick: loads but no feature works. Clicking a ...
2
votes
0answers
488 views

Push failed : Invalid type: Schema.object__mdt Error message when pushing the code from VS Code to Scratch Org

I have create a custom metadata object with records in my DevHub org and i write an apex method that get the custom metadata records but i got an error message in my terminal when i try to push my ...
7
votes
1answer
5k views

LWC : passing parameter to getrecord

I try to create a simple LWC to display an iframe whose url should be store in a custom field of the object So my html is <template> <lightning-card title="URL" icon-name="custom:...
0
votes
1answer
117 views

Why i can't use variable name other then "value" to save my selected value in Combobox (Lightning Web Component)

I'm working on lightning Web Component and i have a combobox. In the Template file i have @track value='' to save my selected value when i change the variable name from @track value='' to @track ...
1
vote
2answers
2k views

How the values changed in html are reflected in js of lwc

I'm iterating my opportunity list in html which has radio group as input values, now on change of the radio options, my js method is getting called. Inside the js, I'm able to get my selected radio ...
1
vote
1answer
721 views

Validation of custom labels value in a lightning web component using jest

I'm building a lightning web component and when adding unit tests, I'm facing the issue that the labels are not rendered in the element when the test is running. What's the best approach to handle ...
15
votes
2answers
12k views

Using unescape HTML in lightning web component

I am currently having an issue to show the content fetched from salesforce database to UI. The data is stored in HTML form and I want it to show on UI using LWC without escaping HTML. Previously we ...
1
vote
1answer
285 views

Navigate to record page from Leaflet Marker Popup

I created a custom Lightning component that displays "Incidents" on a Leaflet map with Markers and a Popup for each Marker. We have a requirement to let the user navigate to the Incident record (...
5
votes
2answers
5k views

Lightning web component listen to Aura Events [duplicate]

I have a Lightning Record Page which uses multiple components, some are LWC, some are Aura components. I am trying to figure out a way to make sure they all refresh nicely. For the Aura components, I ...
0
votes
0answers
88 views

Cannot use custom LightningElement in Custom Tab (Settings page) - Error in the server action response

Cannot render lwc component for settings page in my app, It's sample Lightning element and it works fine with my widget, but i cannot add any LWC on my settings page (custom tab/flexipage). I got ...
3
votes
1answer
4k views

Lightning Web Component: pass parameter from html iteration to javascript

I am struggling to manipulate data from an apex query to the javascript. The value I want to display should take value= 100 - Days_To_Close__c for the progress bar. However, in lwc, I cannot do this ...
3
votes
0answers
2k views

Invalid mutation : [Object Object] is read-only [duplicate]

I am working on building an LWC component for a requirement. I would like to find a way to change/update the properties of an JavaScript Array that contains objects returned from Apex Controller. I ...
10
votes
1answer
4k views

LWC and complex parameters

I am trying to pass a list of objects to Apex from an LWC controller, and it looks like the Apex controller is getting the right sized list, but nothing is populated. Does anybody have any idea of ...
3
votes
1answer
2k views

Salesforce LWC - Pass standard object to Apex Class [closed]

I am trying to pass a Case SObject to apex class as parameter, but is not working. I did not see the System.debug on the console. Why? //wire the record @wire(getRecord, { recordId: '$recordId', ...
3
votes
1answer
831 views

How to refresh or regenerate files in .sfdx/typings?

After I added and renamed some objects in my scratch org and pushed the code, I found that those changes were not reflected in the lwc files under .sfdx/typings. So I thought deleting this folder ...
1
vote
0answers
2k views

Manipulate DOM of LWC using jQuery [duplicate]

I know I cannot do: var elements = this.template.querySelectorAll('[id^="fieldName"]')[0]; elements[0].getElementsByTagName('lightning-formatted-text')[0].setAttribute("style:", "myCSSAttribute:...
1
vote
1answer
707 views

LockerService seems to be blocking adding new properties to JS objects in LWC [duplicate]

I am facing issue with LWC, probably connected to the LockerService's Proxy objects. My code I am getting the list of custom objects defined in one of my Apex classes by calling Apex method from LWC ...
0
votes
0answers
1k views

How to manipulate data coming from Apex in LWC? [duplicate]

I am learning LWC(newbie). I have the below situation where I want to add one additional property to an Object. I am wiring an Apex method as below and inside loop, I am trying to add one additional ...
4
votes
2answers
7k views

Is it possible to pass parameter to javascript method from template in LWC?

I'm iterating through the list of objects, i want to render the class name based on the one attribute from the object. Here is my sample js: <template for:each={tempList} for:item="tempItem"> ...
1
vote
1answer
835 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
479 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
930 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
4k 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 ...
1
vote
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
826 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
678 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
75 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 ...