Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [js]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
8 votes
1 answer
603 views

Can I use wire adapter in classes that do not inherit from LightningElement?

Is it possible to use @wire in classes that do not inherit from LightningElement? Example: export default class A { @wire messageContext; } What I want to achieve: I want to create a ...
Rechu's user avatar
  • 452
7 votes
2 answers
1k views

When LWC that is used in Flow Screen is destroyed?

I need to detect when the LWC is destroyed, so far I haven't noticed that a disconnectedCallback has ever triggered on the LWC that is used in Screen on Flow. This creates a lot of problems because I ...
Rechu's user avatar
  • 452
6 votes
0 answers
378 views

How to correctly enable Type checking in VSCode for LWC?

I wonder how to sucessfully configure type checking in VSCode for LWC. VSCode has JS/TS compiler that support type checking when we set jsconfig.json with compilerOptions like below: "...
Grzegorz Połuch's user avatar
5 votes
1 answer
1k views

Loop in javascript setter takes 1 second per iteration

I have an array attribute in my LWC component which is set from the parent LWC. I have some logic that runs when the this attribute is set. I have used getter and setter for this. My array is a ...
Krish's user avatar
  • 53
5 votes
1 answer
642 views

LWC JS source cannot be edited in browser level where as aura JS we can edit why is that?

Is there any way we can edit the lwc source js code in browser like we can do it for aura ? I just want to find out a way we can edit lwc js in browser level and see live changes instead of deploying ...
vkm's user avatar
  • 137
3 votes
1 answer
876 views

Third-party js lib not being displayed in canvas LWC (Fabric.js lib)

I'm trying to display some shapes using the Fabric.js library. From the console, seems like the fabric.canvas is built correctly, but nothing is being rendered. My code: HTML <template> <...
Michal_LFC's user avatar
3 votes
1 answer
2k views

Importing LWC JS function from different LWC's is not working

I have three LWC's called (not real names) : mainLwc, firstLwc and secondLwc. The mainLwc has helper JS file called mainLwcHelper.js and it has one function inside it. The problem is that I can import ...
Vitalii Dehnerys's user avatar
3 votes
2 answers
2k views

Why the property is not setting in LWC

I have a LWC component. The JS file is like below export default class Atsite_activity extends LightningElement { @api activitydata=[]; @api filterActivityData = []; ...
Noor A Shuvo's user avatar
3 votes
1 answer
2k views

LWC audio / blob component

I have a LWC component and Apex Method, my apex method return a blob element from API response(my API response is a MP3 audio), how can I use this blob element on JS to add in HTML audio element??
PedroRM's user avatar
  • 55
2 votes
1 answer
365 views

Aura Component is referring wrong Static Resource (js method)

I have posted the sample snippet of the problem which I am facing currently. Description I have created two aura components. Each aura component refers different static resources. Both static ...
Jerry's user avatar
  • 23
2 votes
1 answer
1k views

How can I display response data from apex controller in dataTable?

I want to display data that I'm getting from API response in a datatable. The APEX method returns JSON in this format: { "data": [ [ "765919758146423601", ...
Maria's user avatar
  • 25
2 votes
1 answer
3k views

LWC pass date to @wire apex - how to initialise date variable?

I have a component that on first load should display all accounts where a last verified date is 2 years or older. The component has a date selection field where the user can select a different date, ...
Irene's user avatar
  • 1,839
2 votes
1 answer
141 views

How to reduce array and add related integers together

i have this array const input = [ { StockKeepingUnit: 'SKU-001', Quantity: 3 }, { StockKeepingUnit: 'SU-002', Quantity: 5 }, { StockKeepingUnit: 'SU-002', Quantity: 7 }, { StockKeepingUnit: '...
knay's user avatar
  • 37
2 votes
2 answers
2k views

Frontend: get parent element of LWC component checkbox

I am quite new to SF development and as a frontend developer I am experiencing some striggles while taking over a project from a colleague who has just left his job. So please appologize any "...
JonSnow's user avatar
  • 199
2 votes
1 answer
2k views

LWC - lighting-datatable - how to display Vendor_Name__r.Name in Vendor column [duplicate]

With datatable, the 2nd object references (Vendor_Name__r.Name and Purchase_Agreement__r.Name) here weren't displaying in the view. The entire column was blank. @track columns = [ {label: '...
Ryan McNeely's user avatar
2 votes
1 answer
4k views

Clickable and downloadable record in lightning data table LWC

i am facing a problem with a lightning web component, more specifically wit the lightning datatable. In my table i have all the records of ContentDocument that are in my org. I implemented the sort ...
RettoScorretto's user avatar
2 votes
1 answer
151 views

lightning-record-picker search logic

I am using the new lightning-record-picker in LWC that should display 2 pickers. One for City__c and one for Street__c, where proposed streets are only streets linked to the selected city. The search ...
Raphael D's user avatar
  • 616
2 votes
0 answers
739 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:...
Anzar's user avatar
  • 954
1 vote
1 answer
2k views

LWC JavaScript way to copy List [List A, List B] Values to a single List

I'm looking for a way to copy wrapper list of content values to a single list Example: LIST<wrapper> dataAandB= [LIST A,LIST B] => List A =[Object X :{Id,Name ... }] and List B =[Object Y :{...
vkm's user avatar
  • 137
1 vote
1 answer
9k views

Hide/Show columns dynamically of lightning-datatable in LWC

Is there a way to hide/show columns of lightning-datatable dynamically? Not just headers, but the whole columns?
Kostis Kosmidis's user avatar
1 vote
1 answer
2k views

How can I add a onclick action on a specific column in a standard datatable component?

How to have on click action for specific column in data table in lwc. consder this as example, js: columns = [ {label: 'Opportunity name', fieldName: 'opportunityName', type: 'text'}, {label: '...
userName's user avatar
1 vote
1 answer
6k views

How to get community or site name in an LWC component in connectedcallback?

I have one requirement where I want to get the Community name as soon I open it well it can have in any component which is in the DOM of that community page. I can get the page name but how I will get ...
abhi saxena's user avatar
1 vote
1 answer
327 views

How do I pass the date value from the js controller to the apex method?

Trying to pass the date value I get an error. How to fix it? //cmp ... <aura:attribute name="dateExchangeRates" type="Date"/> ... //js getDataForTheDate : function(component,...
unique user's user avatar
1 vote
1 answer
2k views

LWC UI Object Info API get only particular Field Label

The lightning/uiObjectInfoApi module includes wire adapters to get object metadata and picklist values. getObjectInfo -> Can we fetch only metadata of particular field instead of whole object ...
vkm's user avatar
  • 137
1 vote
1 answer
69 views

Incorrect values displayed on LWC

I have created a simple LWC to display a list of account records in a box on clicking of a button but the records displayed on the grid are getting repeated. Controller: public with sharing class ...
code234's user avatar
  • 196
1 vote
1 answer
325 views

Data Showing on Console but not on Component

if i select one or more than one checkbox then their account records should be show on subscriber component Here is the Code ====HTML==== <template> <lightning-card variant=&...
Sourabh Singh Chauhan's user avatar
1 vote
3 answers
5k views

OnFocus and OnBlur is not working for lightning-input in Lightning web components (LWC)

Aim: To call a js method when an lightning input text is filled in LWC form. Eg: After typing Salesforce and moving out the field should invoke the JS function. <lightning-input label="Email&...
Rv1's user avatar
  • 754
1 vote
1 answer
2k views

change even on datetime input field does not track time

I am using a datetime input field in LWC: <lightning-input type="datetime" name="input5" label="ADate Time" value={avlue} min={minEndDate} max={maxEndDate} onchange=...
SfdcBat's user avatar
  • 4,811
1 vote
1 answer
685 views

Salesforce APEX Crypto hash vs Javascript Crypto hash

Trying to generate a hash of a HMAC Sring in Salesforce. The hash generated using APEX in Salesforce is not identical when compared to a hash generated by JS code on the same message. Am I doing ...
Vamsi's user avatar
  • 11
1 vote
2 answers
3k views

action.setCallback(this, function(response) is not getting executed in Helper class

I have a weird behavior of Helper code in lightning component, where the control is not even entering inside action.setCallback, please suggest me if I am wrong: JS Code: doInit: function (component, ...
TKD's user avatar
  • 11
1 vote
1 answer
1k views

Importing third party JS in LWC is not working

I am trying to integrate tinyMCE editor with LWC. I have followed the below steps to do so; Download the tinyMCE resources and uploaded it as static resources in my org I am using the loadScript ...
Mukesh's user avatar
  • 61
1 vote
2 answers
3k views

Difference between getter ,connnectedcallback() in lwc .When to use Getter and when to use ConnectedCallback() in LWC

I need help in understanding the below issue. Looks like a bit weird one or might be i am not aware of basics of LWC. 3 ways to test and understand this :- Comment connectedCallback Code, In this ...
SFDC LWC's user avatar
1 vote
1 answer
161 views

I want to change the color of my utility icon on lwc. No option to add class on its tag: lightning-icon

I have added the utility icon to my table based on condition i.e. dynamically and it's working fine but I want to change its color too which doesn't seem to work for me. If anyone could help. I tried ...
SF Learner's user avatar
1 vote
1 answer
1k views

Update an already edited cell in lightning:datatable

I have a lightning:datatable and this has two columns: start date and end date. The functionality is that when you edit the start date, the end date updates in the table with the same value as the ...
Ivan Ivanov's user avatar
1 vote
2 answers
6k views

LWC get element by value

Why can't I get element by value? I have tried to get id with var, just data and different quotes. //var = id; <lightning-input value={var}></lightning-input> this.template.querySelector(&...
raholed's user avatar
  • 25
1 vote
1 answer
3k views

LWC data table not refreshing after save

I have a datatable lwc that displays data returned from an apex method. When I edit the data and hit on save , the data table doesn't refresh automatically and the cell value remains the same although ...
JackSparrow's user avatar
1 vote
2 answers
2k views

How to get returned sObject values In LWC

I'm very new to LWC, can someone help me with how do I get returned sObject field values in LWC. JS: handleQuoteChange(event) { this.quoteRecordId = event.target.options.find(opt => opt....
whoisnilu's user avatar
  • 115
1 vote
1 answer
1k views

jsconfig.json in sfdx project

Let's say we have got (for some reasons) from git jsconfig.json file in /lwc directory. My questions are : for what purposes do we need to use this file at all in project? i can see in include ...
pincet's user avatar
  • 927
1 vote
0 answers
35 views

dynamic css changes based on selection from dropdown

in this code, based on value from drop down i am tryig to change some css, it is removing css but while selecting another value from dropdown it is not adding css again. handlePaymentTypeChange(event){...
rahul soni's user avatar
1 vote
0 answers
148 views

How do i set the value of a custom column via a LWC

I am trying to set the value of an custom checkbox field for the cart component, so that it can be mapped over to Order and OrderSummary. The mapping between cart, Order and OrderSummary seem to be ...
I am not Fat's user avatar
1 vote
2 answers
153 views

Cannot pass text from LWC to Apex Class

I'm attempting to pass text from a lightning-textarea to my apex handler. I'm still getting null values for the message, but am not sure why. Any help would be greatly appreciated. HTML: <...
kai998's user avatar
  • 69
1 vote
1 answer
174 views

Journey Builder/Custom Activity: inArguments data schema

I am developing my first Custom Activity, and struggling with finding the dataschema with description of an available keys (a.k.a. mustache-selectors) for inArguments field in the config.json e.g for ...
Kiryl Ye's user avatar
1 vote
0 answers
1k views

LWC Error Invalid reference

I have js file in the lwc that keeps giving me the Error Invalid reference, but it still works 100%, i just can't make new changes. I would like to add a validation that there has to be something in ...
Brian23Gt's user avatar
  • 119
1 vote
0 answers
861 views

Generate PDF With LWC

Need to save a pdf of the particular div which include Lightning-Datatable. Below are options I don't want to use as workaround: window.print(); Vf redirect(Solutions without Visualforce Page) Tried ...
Shreyash Vyas's user avatar
1 vote
0 answers
1k views

LWC: Render PDF files as images using pdfjs

TLDR: Any working implementation of pdf.js or other 3rd party js to render pdf as images in LWC would be helpful. I want to render pdf pages as images in order to plot dynamic SVGs. Similar to image ...
Pranav Parakh's user avatar
1 vote
1 answer
432 views

Track property do not work properly with Object methods

Setup: @track states = { first: true, second: false }; What I'm trying to achieve: I want to check if this.states has any true values. What I've tried Object.values(this.states).some(v => ...
Rechu's user avatar
  • 452
1 vote
0 answers
132 views

Lightning aura components not rendering as expected

We have a few Aura components in managed package application. There are few drop down selection inputs, few buttons to redirect from one page to another page etc.. Issue is that these input values are ...
AshSFcloud's user avatar
1 vote
0 answers
607 views

How to make a lightning data table button not clickable after click

I have a lightning data table with columns; inside these columns i have a button. My problem is: i want to disable the button after it is clicked, i tried setting the value, but it's like i work on a ...
RettoScorretto's user avatar
1 vote
5 answers
4k views

Cannot read property 'split' of undefined - in LWC js

I have the following LWC, when I try to add on my lightning record page got some error like, cannot read property of split. js: import { LightningElement, api, track } from 'lwc'; export default ...
Poorna.kj's user avatar
0 votes
2 answers
876 views

Array to String conversion

Can I convert an array to a string in apex? Is string valueOf() method an efficient way to convert it?
code234's user avatar
  • 196