11
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 ...
7
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 ...
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 ...
6
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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.
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 = [...
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....
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....
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 ...
2
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()....
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 "...
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 ...
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="...
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
...
2
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 ...
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 ...
2
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)
//...
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 ...
2
votes
page locator changed after winter 22 upgrade
Starting in Spring '19, all the release notes started including this disclaimer that is also called out in Winter '22 that explains these things could change after a release
The content and structure ...
2
votes
Accepted
How to pre select the first row in LWC datatable
The map() method
creates a new array populated with the results of calling a provided function on every element in the calling array.
That's why you're getting that warning in the browser's console.
...
2
votes
How to change default view of the lightning-file-upload LWC component
unfortunately, as for now Winter '22 it is not possible to customize lightning-file-upload component and set something custom in the slot of the body.
You'll need to build a custom file-upload ...
2
votes
Accepted
Cannot update list in JS after assigning value to field in that list
You need to modify the original variable. As you've probably noticed, however, the data is read only. tempVar is disconnected from the original data because you used JSON.parse(JSON.stringify(...
2
votes
Accepted
Hide/Show columns of lightning-datatable in Lightning Web Components
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"
...
2
votes
Accepted
how to call two functions in one onclick in lwc?
You can call both methods at once with Promise.all:
async handleSearch() {
const searchKey = this.key;
const [accounts, contacts] = await Promise.all([
getAccounts({ searchKey }), getContacts({...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
js × 99lightning-web-components × 78
apex × 21
html × 15
javascript × 12
lightning-aura-components × 11
css × 7
lightning × 6
lightning-datatable × 6
community × 4
aura × 3
static-resources × 3
third-party × 3
visualforce × 2
json × 2
list × 2
date × 2
lwc-wire-adapter × 2
datatable × 2
iframe × 2
lwc-dom × 2
crypto × 2
lightning-combobox × 2
winter22 × 2
soql × 1