Questions tagged [lwc-dom]

The tag has no usage guidance.

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

How to select a element using querySelector that has dynamic name?

I have a lightning-button-icon with dynamic name and i want to update its selected attribute based on the name. Can someone tell me how can i do that? my code (UPDATED): <lightning-layout-item size=...
0
votes
1answer
27 views

Refresh button with time in lwc?

I have kept the refresh button my requirement is when I click the refresh button it needs to show the time for each time refreshing the page or record there is any resolved solution? Like this, I need ...
3
votes
1answer
73 views

What is Lightning Element in Lightning Web Component

I have gone through definition of LightningElement but unable to understand it clearly. Definition LightningElement is a custom wrapper of the standard HTML element.It extends element to create a ...
0
votes
3answers
65 views

disable the cursor pointer on lightning-output-field in lwc

i am trying to disable cursor on lightning-output-field phone field but no luck. my styles are not rendering in UI. is it because am i applying styles for child elements? lwc.html <template> &...
0
votes
2answers
30 views

LWC: How to display svg icons

I'm trying to render a button with an icon just next to the text, unfortunately, the icon doesn't show even if it uses the space next to the text. <template> <button class="slds-...
0
votes
1answer
21 views

Lightning Web Component Issue in fetching the particular value in child component{Coming as undefined}

Hi i need to fetch the value of "defopen" from the JSON array i am passing , but getting as Undefined, kindly anyone please help. <c-childcomp dtest={stest}></childcomp> ABC(...
2
votes
2answers
80 views

How to get label of the node in lightning-tree in LWC

What is the way to get the label of the lightning-tree node on-click/on-select on javascript handler in lwc? myLwc.html : <lightning-tree items={sidebarStructure} onselect={handleSidebar}><...
0
votes
1answer
40 views

overflow LWC tabs to scroll horizontally

When we click on the more button the remaining tabs are coming vertically instead I need to achieve horizontally So if i click on the arrow in right tabs have to move horizontally. Is there a way we ...
0
votes
0answers
40 views

Iteration in LWC not working for 2nd element of input array

I am working in LWC requirements where I have a list of records using this list I need to create inputs text. Once I loop through the list in LWC 'HTML component' my input texts are coming as aspected ...
0
votes
1answer
62 views

LWC create input fields under LWC iteration

I am new to LWC. I have to create multiple input fields for different rows. Let say, I have selected 3 records from the previous page and for all those 3 records I need to create the input field and ...
0
votes
1answer
36 views

How is the <template> tag used in lwc different from one used in web components?

According to usage of <template> in web components: The elements under template won't appear in your page until you grab a reference to it with JavaScript and then append it to the DOM For ...
0
votes
0answers
39 views

how to get the omniscript Vlocity data where my LWC is located?

I am new to LWC with Vlocity, I want to create an LWC that consumes the data found in the omniscript where the LWC will be hosted, how can I do this?
0
votes
2answers
48 views

In lwc lightning-combobox not able to select a value when binded dynamically, If i bind it with hardcoded values then i am able to select it

I am using below code to populate a combobox with dynamic value. But i am not able to select any value and it just gets back to blank value with placeholder text. HTML Code <template> <...
0
votes
0answers
15 views

Handle two check-boxes using same onchange event in javascript lwc. Getting same checkbox id for both the check-boxes

Getting same name and id for both the checkbox onchange event. Kindly, refer me to the best practices to access an element in javascript for lwc. Demo.html <lightning-layout-item size="6" ...
0
votes
1answer
29 views

Selection done in one iteration in aura, is reflecting in every other iteration

I have a scenario where I am calling a custom lookup lwc component inside my aura iteration. The issue is the value I am selecting in the custom lookup in one iteration is being reflected in all the ...
1
vote
1answer
47 views

Unable to Close Drop down menu on Outside click in LWC

I am unable to close the dropdown menu in LWC on clicking anywhere else on the page apart from the dropdown menu . Please find the code below , HTML Code : <a class="userStyle" role="button" ...
0
votes
1answer
320 views

how to convert CSV file to array of JS objects in LWC

I have a custom LWC page where I am importing an array of JS object to CSV and it is working as expected now I need to do some changes to that csv file and upload it on the page and convert it back to ...
3
votes
0answers
76 views

Lighting Data Table with large data set lagging on chrome browser

So I have this requirement to show folder and report as a hierarchy in LWC (used lightning tree for the same with custom icons for folders and reports.) and on click of any report, we fetch the report ...
0
votes
0answers
29 views

Unable to apply if condition in iteration in LWC [duplicate]

<template> <lightning-card variant="narrow" icon-name="standard:opportunity"> <h1 slot="title">{Name}</h1> <h1 style="margin-left:4%;">{Header}</h1> ...
0
votes
1answer
151 views

Freeze first column in the lightning data table lwc

How to freeze the first column vertically of the Lightning Data Table LWC ? Since LWC is enforcing the shadow DOM style scoping. I have encapsulated the LWC component inside an Aura component and put ...
1
vote
1answer
58 views

Set Salesforce LWC Variable from D3 data

I am able to visualize my D3 chart within a Salesforce LWC component, but now what I want to do is when I click on a selected node within the D3 code, I want to pass the selected node data (d.data) to ...
0
votes
1answer
30 views

Adding class for inner components applies to every components in the org

I'm adding some style to my lightning-card so it can look like Salesforce's standard related lists. This is the code, note that i'm using a specific ID so, in theory, it will only apply to that card. ...
0
votes
1answer
122 views

Create dynamic picklist in lwc

I have custom table with the multiple rows and there are two picklists in each row. Picklist options are as follows: @track picklist1 = [ {value: 'w1', label: 'w1'}, {value: 'w2', label: ...
1
vote
0answers
173 views

Print only table data in Lightning Web Component(lwc)

When I click on the button I need to print the only table data. Ex: this.template.querySelector('.tablecls'); I tried the below options Option 1 window.print(); The above option is printing the ...
0
votes
1answer
53 views

Salesforce LWC : how to call a method of the loaded script in the javascript? [closed]

how to call a method of the loaded script function in the javascript? Ex: if I have loaded a script named ‘abc’. Now I want to call a method of the abc. Let the method be fgh. How do I call it in LWC?
0
votes
2answers
122 views

Hide save button in lightning table in LWC

html: <lightning-datatable data={addressData} columns={columns} onsave={handleSave} key-field="id"></lightning-datatable> Js: handleSave(event){ let ...
0
votes
1answer
32 views

Add both dynamic and literal CSS classes to the same element

Pretend I have an element that I wish to give a literal class, such as: <p class="slds-text-title">My Title</p> But I also have a dynamically determined class I wish to add, which I ...
2
votes
2answers
491 views

Append child dynamically from JS in LWC

I am facing a problem in the following code in my lwc component. Whenever I try to append a child dynamically from Js in LWC component. I got this error. HTML : <template> <lightning-...
0
votes
1answer
52 views

Lwc- problem to get id as it changes with random no. inside external Js

Hi all I am trying to access the id of a div in lwc with the help external js(static resource) where code is like document.getElementById("createsulightning"); for <div id="createsulightning">&...
0
votes
1answer
74 views

Confused displaying Visualization in LWC

I'm trying to display a basic visualization in LWC using vis-network.js. The example I'm trying is here Here is my code. Component.html: <template> <lightning-card title="Sand Samples&...
0
votes
0answers
62 views

LWC not able render Html JS

Below is my requirement - From Salesforce we are calling a service which returning a large set of html which include JS. When Copy paste same html(including js) in notepad++ and save it as .html ...
2
votes
1answer
481 views

Order of execution in Lightning Web Components

I have a parent and a child component below is the code: Parent component HTML: <template> <lightning-tabset> <lightning-tab label="Child One"> <c-child-...
0
votes
1answer
462 views

LWC setCustomValidity on lightning-input-field

I'm using a <lightning-record-edit-form> with <lightning-input-field> children. When required fields are not populated, it occurs the standard message "Complete this field". What I want ...
0
votes
1answer
197 views

Lightning Web Component dynamic action button name

I'm trying to get a dynamic lightning button using Lightning Web Components, what I currently have is a wrapper class which builds the necessary data I need and outputs it neatly in a table. This is ...
1
vote
1answer
292 views

How to reset or deselect lightning-radio-group option

Once selected, radio buttons cannot be deselected. Is there a way to reset the lightning-radio-group component or deselect the selected option?
0
votes
1answer
217 views

How to access shadowroot elements from JS in a LWC component

I have the following HTML in my LWC component- <template> <div class="firstdiv"> <div class="firstinsidefirstdiv fifd"> 1234 </div> <div class="...
0
votes
1answer
208 views

Salesforce LWC aura_prod.js:3 Uncaught (in promise) TypeError: Cannot read property 'Symbol(ViewModel)' of undefined

I am getting below error when i try to pass data to apex. I did everything to debug but unable to find root cause. aura_prod.js:3 Uncaught (in promise) TypeError: Cannot read property 'Symbol(...
0
votes
0answers
73 views

Hook into before unload of salesforce standard tab in lighting web component

Is there any way to detect and execute some JavaScript method before unload of salesforce standard tab inside LWC.
1
vote
2answers
1k views

Get labels and values of each field in lightning-record-view-form in LWC

I want to get field-name(label) and field-value of each field for validation as shown below. Is there any way to do it in LWC? sampleRecordViewForm.html <template> <lightning-record-...
3
votes
1answer
322 views

Dynamically changing lightning button icon name with setAttribute not working

I'm trying to change the icon of a lightning button icon but the image isn't changing however I see that the attribute is being updated. this.template.querySelector('#'+event.target.id).setAttribute(...
1
vote
1answer
737 views

Dynamically set the onclick function in LWC button

I'm trying to dynamically set the onclick function of lightning web component button but it's not working. I've tried both "click" and "onclick" JS: const navButton = this.template.querySelector('....
5
votes
2answers
393 views

How to run “ $('div').clone().appendTo('.wrapper'); ” in LWC? [closed]

I want to achieve this in LWC. I want to call the same HTML content (ex- div, p) multiple times in iteration & append them one below other as shown in above link. I used this $('div').clone()....
2
votes
1answer
141 views

LWC + Jest: Make assertions about an element's rendered style

In a LWC project, I'm setting certain child component style properties from the parent component. I want to test that an element in a child component shows up with those properties when it's rendered,...
1
vote
1answer
571 views

LWC: unit testing component using validity object

I have an lwc component which validates some input fields before performing a post request to the server. I'm writing a unit test where I'm testing that the post request is called when all input ...
0
votes
1answer
610 views

How to set typeattribute in LWC datatable?

{label:'FCU Trigger', type: "button", typeAttributes: { label: 'Initiate', name: 'initiate', ...
5
votes
2answers
639 views

Clarification on what this.template.querySelectorAll lets you see in LWCs: want to modify field labels

I have a form rendered using just a lightning-record-form - very cool to get so much done by this single LWC (Lightning Web Component). But I'm trying to replace the labels with the inline help text ...
0
votes
0answers
247 views

How to use jQuery Datatable in Lightning Web Component?

I was trying to get jQuery Datatables work in my LWC. I have tried this: LWC is it Possible to Load the JQuery Plugin Datatables in a Lightning Web Component? But I was not able to get it work. ...
3
votes
0answers
143 views

Highlight modified fields in LWC

I have a complex UI that renders multiple <lightning-input> fields. When the user edits these fields, I store the originalValue (usually passed through an @api property), the newValue and the ...
1
vote
2answers
1k views

Dynamically change color of text/numbers in LWC?

I want to change values of text/numbers dynamically depending upon certain conditions. (3 colors - Red, Yellow, Green) So like depending upon value of numbers (like if its greater than 10 i want to ...
0
votes
1answer
1k views

Empty check in LWC html

How to do empty check like we used to do in Aura bundle <aura:if isTrue="{!not(empty(v.opportunityList))}"> I have a datatable in the lwc and want do display a message when no data to display ...