Questions tagged [lwc-dom]
The lwc-dom tag has no usage guidance.
208
questions
0
votes
1
answer
28
views
LWC Template tag not working for conditions
<template if: true= {isFlagValue}>
showing some content on page when isFlagValue true but after getting false value for isFlagValue I am able to see content
Heading
0
votes
1
answer
37
views
Change Data Capture and LWC on Mobile App?
I Have a LWC component setup to use CDC to refresh the apex of a varity of objects this intern affects the DOM (icons change / menu options change etc) this works fine on desktop however on the ...
0
votes
1
answer
75
views
Increase the performance/speed of Jquery dataTable in a LWC component
I'm using Jquery dataTable in a LWC component to load around 1500 records from Salesforce into the table. I'm using a SOQL query to fetch the records from SF and load them into the table. The data is ...
-1
votes
1
answer
65
views
Salesforce LWC nested for each loops with if condition
I am trying to implement a listbox in LWC. The list box is showing values from a picklist in Account object. On click the value of the selected item is adding to an array. But on the UI it is not ...
0
votes
0
answers
105
views
Access this.refs / lwc:refs="" when testing in jest?
I am attempting to use this.refs from with a jest test like this:
<template>
<input lwc:ref="inputEl" />
</template>
// input.test.js
import { createElement } from 'lwc'
...
0
votes
1
answer
54
views
LWC issue with array variable being blank when accessed from another function
I am building a custom file upload component as follows. I prepare my list of uploaded files inside the function handleFilesUpload. I then call another function called handleSaveFiles but inside of ...
0
votes
1
answer
61
views
@api variable name is 'template'
In my LWC we have a variable name 'template' .
@api template
Due to which below line is not working.
...this.template.querySelectorAll('lightning-input')
Is there another way to grab all input ...
0
votes
1
answer
82
views
Throw an error and block users when LWC is placed on wrong page type
I'm trying to do something, but I am stuck on this scenario.
So, I have a lwc that can be placed on multiple pages (Record Pages, Home Pages etc).
The users will define the component destination, in a ...
0
votes
1
answer
146
views
LWC lightning-modal initial focus on header
According to documentation lightning-modal documentation
When the modal opens, focus goes to the first interactive element in the modal. If the header includes a link in tagline text, the link gets ...
2
votes
1
answer
135
views
LWC - Using lwc:dom="manual" to render text with innerHTML but it does not work
I'm using lwc:dom="manual" and querySelector to capture and display the text content but it does not work.
HTML code
<h2 class="slds-truncate" title={record.Name}>
<a ...
1
vote
1
answer
33
views
Newly record not showing up when created using the 'createRecord' from 'uiRecordApi'
I am practicing Apex but I guess I'm stuck on trying to achieve something. I have a memory game in Apex. When a user finishes with the game, an record is inserted using the 'import { createRecord } ...
0
votes
0
answers
98
views
How to render an array of objects (label,value pair) effectively on a lightning checkbox group functioning as a dropdown?
I need a checkbox group as a dropdown and have the following array formed in LWC JS
handleShowingStateFilters(resultSet){
this.stateFilterOptions = [];
this.tempArray = Object.keys(...
0
votes
1
answer
48
views
I can't refresh the data from the button on LWC component
I created this component and the idea is to get all the files and put in one place. But I also need to add a refresh button, so it could return and new files that were uploaded.
But I am not sure how ...
0
votes
1
answer
2k
views
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'values') [duplicate]
I need to render some values in the screen based in boolean variable (isLaborOrPartsLabor), and i'm setting this one in a method inside the renderedCallback(), basically, when this one it's true i'm ...
1
vote
1
answer
105
views
LWC @api param is being passed by reference or not?
I have a parent component with this JavaScript code:
import { LightningElement, track } from 'lwc';
export default class ParentComponent extends LightningElement {
myValue = {
value:'hello'
...
0
votes
1
answer
158
views
After adding a slds float left for second line onwards its not aligned to left any suggestion for this?
<div key={rec.Id} class="slds-clearfix slds-float_left">
<h2 class="slds-text-heading_medium slds-hyphenate heading-title">
{rec.Name__c}
</h2>
</div>
...
0
votes
1
answer
239
views
How to change the css of a standard SF component in LWR site
I have been using an LWR site with no theme selected (Basically a blank theme).
I have used the web-to-lead markup in a custom LWC, but I need to change the styling of the form.
Is there a way to do ...
0
votes
0
answers
29
views
How to refresh the list of records in lightning-datatable after adding a new record to it in LWC [duplicate]
I have an LWC component which has a list of records displayed onload from a wire method. I have an Add button below the list to create new values from a modal save. Now, When I click the add button, I ...
0
votes
0
answers
149
views
How to call renderedCallback() in HandleChange field input only once
I have LWC with search input, with every handleKeyChange click on input, renderedCallback() is called, but I need it to call only once.
Controller:
@track hasRendered = false;
@wire(getAcc, { ...
6
votes
1
answer
1k
views
Alternate to if:false in LWC
Now salesforce is going to deprecate if:true & if:false and the alternate to these 2 tags is lwc:if, lwc:elseIf and lwc:else
Now replacing if:true is simple, just change it to lwc:if but if I want ...
-1
votes
1
answer
145
views
Can we add a onclick listener to the Sales Path on Opportunity?
The Opportunity Sales Path I'm using is a standard one, and not taking the lwc route to implement the path. Is there a way to listen to any change here by some event listener on my lwc? So far, I have ...
0
votes
1
answer
310
views
Salesforce LWC - State management in checkbox input control
I am new to salesforce LWC. Developing a page with a checkbox inside a component. So my task is to maintain the state of the checkbox even after the page refresh. For this, I used session management ...
0
votes
0
answers
126
views
recordId is blank in imperative call
I have an lwc action button that loads the popup. When i load the component for first time, recordId is present. But when i close and open it again(without reloading the whole page), recordId is lost. ...
3
votes
1
answer
442
views
Can you create a slot that moves in the DOM?
I have a generic component that renders a form in a slot.
I want the layout of the component to be changeable. E.g. move the form from the right hand side of the screen to the top.
The layout changes ...
0
votes
0
answers
45
views
Intra-page links in a Lighting Web Component (LWC) that break because ids are dynamically altered
Salesforce LWCs dynamically change HTML ids to ensure uniqueness. This is creating a challenge for one of our components that dynamically renders an SVG. My question isn't specific to SVGs though. It'...
5
votes
1
answer
201
views
Loading / Destroying Many LWCs
I am looking to see if there are any best practices when developing a large LWC "app".
The main challenge I am seeing is when I want to display a certain "screen" to an end user, I ...
0
votes
0
answers
99
views
Quick Action - Detail Button Page Error - LWC
can anyone help me with this error,
My requirement is:
I have a Detail page button called Convert on Order Object, when I click on the convert button it should convert the order object Record to ...
0
votes
1
answer
691
views
Resizable divs in LWC
LWC playground
https://app.lwc.studio/edit/CTHEQCGrn18rKmQQ0zs1
I have below HTML
<section class="resizeable-container" >
<div class="resizeable-item">
...
1
vote
0
answers
217
views
Issue importing dependent libraries in LWC
I'm trying to create an orgChart in LWC to represent how my objects are set up.
I found the following library to do it : https://github.com/bumbeishvili/org-chart
When looking at the examples, he ...
0
votes
2
answers
501
views
LWC Event to Catch internal Salesforce Navigation [duplicate]
My Question :
Are there any events which checks whether user navigates to which navigation menu right now ?
For Example :
When I am at Case Record Page and my LWC is placed there,
So If I switch to ...
1
vote
1
answer
350
views
LWC Local Server says Couldn't find the custom component when I pass attribute using Custom Event from child to Grandparent
Im trying to do a simple operation which is pass an attribute from child to grandparent in LWC using Custom Event where I set the Bubbles and composed attribute to true to pass it through the ...
2
votes
1
answer
451
views
How to pass the array of values to mult-picklist from LWC to apex
{
"language": "English",
"country": "GB",
"successValidation": true,
"businessEmail": "[email protected]",
"...
2
votes
1
answer
746
views
Adding third party library to Salesforce LWC
I'm trying to create an address search component using Dawa Address library (Danish Addresses) https://dawadocs.dataforsyningen.dk/dok/guide/autocomplete#trin-2-installer-dawa-autocomplete2-...
0
votes
1
answer
506
views
Lightning Icon not changing iconName dynamically
In my lwc html I'm using
<lightning-icon icon-name={iconname}></lightning-icon>
In .js setting value in icon-name on any event say platform event,
this.iconname = 'utility:success';
OR
I ...
0
votes
0
answers
39
views
LWC.CreateElement? [duplicate]
I was researching for document.createElement() and could not seem to find anything. Is there any way where I can use createElement in salesforce or any other Alternative as I need to create div ...
1
vote
0
answers
59
views
LwcWebpackPlugin with AliasModuleRecord for lwc.dev isn't loading HTML file for component
I use LwcWebpackPlugin to load Lightning Web Components. Everything works fine but because I want to load compoennts from 'lwc' direcotry the namescape won't work.
I must get components from /lwc ...
0
votes
1
answer
448
views
How to track change on an Account field in LWC?
Whenever I change a specific field (for example Account Name), I want to set a template if:true to false, in order to hide an element.
I'm using @wire to get the account name from the record page, as ...
0
votes
1
answer
91
views
How to update data on unrelated components?
So I have two unrelated components on one page. And when items are added\deleted on the first one they need to be displayed in second component. I use this: eval("$A.get('e.force:refreshView')....
1
vote
0
answers
288
views
Uncaught Reference Error : newAge is not defined throws at "myPlaygroundLink"
The component I wanna create should recieve input from user and update newAge variable that I have defined and should console log it, but when I try to enter value this popup comes with error
...
3
votes
0
answers
287
views
Implementing jstree library with Lightning Web Component
This will be a long one, hoping someone can help.
Problem Summary: I'm unable to integrate the "Drag and Drop" (dnd) plugin functionality with my LWC that utilises the jstree library (https:/...
1
vote
1
answer
3k
views
Chart Js: How to display data values in chart js bars
I have built simple bar chart with ChartJS version v2.8.0, so now I am trying to display the data values on each bars using chartjs-plugin-datalabels v1.0.0 plugins chartjs-plugin-datalabels I have ...
3
votes
1
answer
484
views
How to sort the elements is lightning-dual-listbox based on the label?
I am trying to sort the elements in the dual list box, unfortunately i did not find any correct way to do it.
This is my html component
<template>
<lightning-dual-listbox name="...
0
votes
1
answer
1k
views
LWC jest test on conditional element
How can I test if:true element in my lwc? showLoadingSpinner is @api. I am new to jest, sorry if stupid question. Console log shows null.
<template if:true={showLoadingSpinner}>
<div id=&...
0
votes
1
answer
762
views
How to retain user-input in lightning input field
I created an LWC in which I have 3 parts on a page: (here Allergy & Medication are visible).
1st page has 2 input fields, and to view each part of the page, a boolean variable is used (template ...
2
votes
0
answers
666
views
undefined value from html button value attribute
I am iterating an array in template and on the button click I am trying to get the value of selected element but the value coming is undefined
<template>
<template for:each={pages} for:...
0
votes
1
answer
3k
views
LWC add custom data-type checkbox and extending lightning-datatable
I have a requirement where I have implemented the lightning-dataTable with the custom-dataType column checkbox.
As you can see in the screenshot, I have a requirement where
onCheck of the parent row(...
0
votes
0
answers
391
views
Is it right way to check CRUD Permission in LWC?
import { LightningElement, wire } from 'lwc';
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import ACCOUNT_OBJECT from '@salesforce/schema/Account';
export default class CheckPermission ...
0
votes
1
answer
2k
views
How to select an element inside a template if true in LWC Jest test?
I have an LWC app that has a lightning-input and a lighning-button. It fetches data from the server for a record whose ID is specified. I have successfully mocked the server calls.
I am trying to ...
0
votes
1
answer
886
views
Cannot change or access class member variables from callback function
In the below code, the function dragstarted() is D3 JS function that gets called everytime a graph node is clicked (which gets called fine). However, it is not possible to change 'clicked' or call '...
1
vote
1
answer
908
views
Do something every time an @api property value changes in child component [duplicate]
I am passing a property from a parent to a child component. I am trying to perform a task every time the value passed from a component's parent to itself changes.
export default class displayData ...