Skip to main content
13 votes
Accepted

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

I'm afraid that Lightning Locker won't allow you to use that js lib, for the several reasons: new fabric.Canvas() constructor can take either <canvas> element or its id to initialize an ...
Oleh Berehovskyi's user avatar
8 votes
Accepted

Loop in javascript setter takes 1 second per iteration

On the assumption this is this performance issue, this is effectively a bug in the LWC infrastructure. The workaround is to ensure each component accepts the array in an API property with a setter and ...
Phil W's user avatar
  • 36.8k
7 votes
Accepted

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

Yes. You can use concat: var output = listA.concat(listB); Or you can flatten it: var output = [listA,listB].flat(); Arrays in JS are very robust. You should take time to study their many features ...
sfdcfox's user avatar
  • 495k
7 votes
Accepted

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

If it's a simple LWC setup, I suggest using the Playground on the main developer site. You could also explore LWC local development which avoids having to deploy to server. There's a way to connect ...
Brian Miller's user avatar
  • 5,222
6 votes
Accepted

Array to String conversion

I think String.join() method is what you are looking for, since it Joins the elements of the specified iterable object, such as a List, into a single String separated by the specified separator. For ...
Oleh Berehovskyi's user avatar
5 votes

When LWC that is used in Flow Screen is destroyed?

Its slightly tricky. disconnectedCallback is only called if a component is removed from the DOM, and this depends on the experience you are in. Lightning Experience keeps the 5 previous pages you've ...
Aditya Naag's user avatar
5 votes
Accepted

Hide/Show columns dynamically of lightning-datatable in LWC

The only thing you need to do is removing the desired element from the columns array, or use the original set if you want it back. <template> <lightning-input type="toggle" ...
McCubo's user avatar
  • 693
4 votes
Accepted

Aura Component is referring wrong Static Resource (js method)

All components in the same namespace (e.g. c or mynamespace) share the same window, so anything you put on that object is shared across all components in that namespace. That object is essentially the ...
sfdcfox's user avatar
  • 495k
4 votes

Array to String conversion

It rather depends on the purpose of the conversion, but an efficient and controllable means is to use String.join as mentioned by @Oleh Berehovskyi. Here you can choose an appropriate separator, ...
Phil W's user avatar
  • 36.8k
4 votes

Status is picklist field when Status is 'Open' only then the Submit Button Display on that Record otherwise Button should be Hide Using LWC

<template for:each={data} for:item="tts"> <tr key={tts.Id}> <td><lightning-input type="radio" name="radioButtonSelect" value={tts.Id} ...
Karan Sharma's user avatar
  • 1,197
4 votes
Accepted

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

Yes, this is something that can happen because of how things are bundled before being sent to the client. It is for this reason that I always recommend using a service component. Separating your ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

Why getElementById doesn't work in LWC

The reason is lwc framework changes the id you define in the html template to some unique values and that is where your defined id becomes irrelevant. As per the documentation you should not use ID ...
Ankur Gupta's user avatar
3 votes
Accepted

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

Looks like it is a query exception and has nothing to do with way you are passing in the attributes. Try using the below return Database.query('SELECT Date__c, Base_Currency__c, ' + currencys + ' FROM ...
Mohith Shrivastava's user avatar
3 votes
Accepted

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

Wire methods don't fire on "undefined". You need to make it null instead: inputDate = null; Or, alternatively, set a specific date: inputDate = new Date(new Date().setFullYear(new Date()....
sfdcfox's user avatar
  • 495k
3 votes

How to deselect the checkbox when max row selection is set to 1 in LWC?

Your code has multiple issues. You're creating multiple lightning-data-tables, but then you only have a single preSelectedRows variable. You're assigning your slice to a local variable, not a variable ...
sfdcfox's user avatar
  • 495k
3 votes
Accepted

LWC UI Object Info API get only particular Field Label

There's no API to get the describe for a single field, so there's also no LWC wire method you can use.
sfdcfox's user avatar
  • 495k
3 votes

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

You can get the basePath from the Summer '20 module to get the community name: (source: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_salesforce_modules) //...
Stephane ITBRM's user avatar
3 votes
Accepted

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

Implement a custom data type with your html executing modal on click Recently a new feature was released which allows to define custom data types in standard lightning:datatable component. Create a ...
Patlatus's user avatar
  • 17.2k
3 votes
Accepted

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

You need to parse your JSON into JavaScript Object and then manipulate with that object. If you always get the same JSON format the Code for you will look in next way : Apex : public with sharing ...
Vitalii Dehnerys's user avatar
2 votes

How to get the name of the lookup field instead of id in LWC

This is a use case for getFieldDisplayValue: import { getFieldDisplayValue } from 'lightning/uiRecordApi'; import COMPANYNAMEFIELD from '@salesforce/schema/Payment__c.Company__c'; ... const FIELDS = [...
sfdcfox's user avatar
  • 495k
2 votes
Accepted

How to get the name of the lookup field instead of id in LWC

try to use Name in your fields definition const FIELDS = ['Payment__c.Company__r.Name']; handleClick(event) { const company = this.payment.data.fields.Company__r.value....
Klecool's user avatar
  • 848
2 votes

how to deal with proxy() object via lwc?

This is how LWC or as a matter all Lightning components work. Your code works fine. I created a button to check and it gave correct xxx @track historyData = [] connectedCallback() { this....
Nagendra Singh's user avatar
2 votes

How to fetch the value of Lightning input having specific name

You are trying to access the field value on button click using querySelector, but you cannot use name attribute to identify a particular lightning input field inside querySelector. You can make use of ...
sanket kumar's user avatar
  • 15.4k
2 votes

Importing third party JS in LWC is not working

It doesnt look like TinyMCE will play well with LWC. Requires a lot of DOM manipulation which LWC (on platform) locks down quite a bit. Eventhough LWC looks quite vanilla on the surface, it runs "...
lu_ke____'s user avatar
  • 433
2 votes
Accepted

Open an Link from a LWC in a new Tab

Due to your website format (google.com), it'll function as a relative URL which makes it root-relative and uses the domain of the page as the prefix (as you noted). You need to add a forward slash to ...
Kris Goncalves's user avatar
2 votes
Accepted

Why don't I get the String value returned from apex in js in the LWC project?

let userCity = getCityCurrentUser(); An imperative Apex call returns a Promise, because it has to go to the server and back. JavaScript won't wait by default, giving you just the Promise, so you have ...
sfdcfox's user avatar
  • 495k
2 votes

How to deselect the checkbox when max row selection is set to 1 in LWC?

Learning Resources You should review the LWC documentation, JS, and Trailhead, as others have already pointed out multiple issues with your code: Build LWC Trail in Trailhead LWC Developer Guide ...
gale-force-wizard's user avatar
2 votes

How to change the pictures' shape to circle?

Use lightning-avatar to get the desired effect. Here's an update for your code: <lightning-tile label='' type="media" variant="Narrow"> <lightning-avatar variant="...
sfdcfox's user avatar
  • 495k
2 votes

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? No. You can save/deploy the file, but it won't work. Dragging it onto a page (even without a HTML file) will throw ...
Kris Goncalves's user avatar
2 votes

page locator changed after winter 22 upgrade

It's absolutely possible. The exact element structure of Salesforce pages is not a committed API contract. In maintaining our Robot Framework keyword library, we regularly find small changes to ...
David Reed's user avatar
  • 93.2k

Only top scored, non community-wiki answers of a minimum length are eligible