New answers tagged

2

This code basically suffers from trying to update components outside of itself, resulting in the previous boxes staying open. This was solved by adding/changing the following code: @track _mOptions = []; _isOpen = false; _firstOpen = false; _docHandler; connectedCallback() { this._docHandler = () => { if(this._isOpen && !this....


0

Did preventDefault() not help? export default class RecordFormEditExample extends LightningElement { handleSubmit(event){ if(event.keyCode == 13) event.preventDefault(); } } If you need enter to work on the button, combine this with onclick event.


1

A few potential issues here, which may or may not be relevant. First, you didn't say you actually defined typingTimer in the class. It should be defined as a value: export default class... { typingTimer; Second, you should probably store the value you intend to send to create a closure: handleSearchCriteriaChange(event) { clearTimeout(this....


0

Reached out to our expert's team internally Believe this is called "debouncing". Something like this should work handleSearchTermChange(event) { // Debouncing this method: do not update the reactive property as // long as this function is being called within a delay of 300 ms. // This is to avoid a very large number of Apex method calls....


2

I note the use of "self" as a hack to work around the loss of the "this" binding for the LWC component instance, relying on the closure to inherit the "self" value. An arrow function should work, since "this" should not be messed with. Perhaps you left it using "self" which may have messed it up. If the ...


0

Typically a question of this nature would be placed on Stack Overflow, not here which is primarily Salesforce. I can offer a quick solution to this but you will need to address potential exceptions. Your arrays may grow and this suggestion might need to be revisited. PS, I am no expert in JS. FYI, dataArray is invalid JSON. Please use a format/validate tool ...


1

You should be able to get the page parameters using lighting-navigation module once you land off to a lightning page with URL parameters that has auth code. The below code should help import { LightningElement, wire } from 'lwc'; import { CurrentPageReference } from 'lightning/navigation'; export default class MyComponentName extends LightningElement { ...


0

If it's already an array, you can't split it (you can split a String). I think you mean to join it instead: var str = records.join('') Which would result in the output you're looking for.


0

Even I am trying to pull the Ampscript Data into Javascript Variable. Your approach didnt work for me. Couple of questions here: Where should the Script Tag included? Is it inside Head tag/inside Body tag/after body tag? Tried with Document Ready/body onLoad functions too. No luck! Tried with Wait time to load element, I could see the element in console ...


0

For whoever is interested: The functions which were being invoked on the child component were defined as arrow functions. After replacing them for traditional functions it works as expected. It would be interesting to know WHY arrow functions impact the namespace (apparently) though, so if anyone knows why this is happening please feel free to add your ...


2

I'd refactor your code so that you don't need to worry about it. Yes, you can indeed make the columns dynamic, you just need a mechanism for that. Here's a possible solution: public with sharing class ObjectController { public class Column { @AuraEnabled public String fieldName; @AuraEnabled public String fieldLabel; @AuraEnabled ...


1

Try to use import '@lwc/synthetic-shadow'; in your index.js


1

Neither is strictly better when comparing all features. Apex is better in terms of security (no authentication info needs to be sent to browser), and does not have to worry about CORS restrictions, but does have severe limits to ingress and egress bandwidth, callout timeout limits, and CPU limits. In addition, you cannot access resources not available to the ...


3

The Navigator's mediaDevices property is not available with Locker Service. however, here is an idea posted a few years ago which you can upvote Make navigator.mediaDevices available in Lightning Components API (WebRTC) This might be confusing, given that Salesforce's Locker API Viewer documentation states otherwise, but the property itself returns undefined....


1

Here is simplified version of code which works. HTML: <template> <tbody> <template if:true={actualResults}> <template for:each={actualResults} for:item="keyValue"> <tr key={keyValue.key}> <td scope="col" style={keyValue.styleColor}> ...


0

If you are saying that your PDF generation is hosted on Heroku then you don't need to execute JavaScript from the Process Builder, you need to do Callout. Here I found an example of how you can do it http://cloudyworlds.blogspot.com/2015/03/invoking-apex-callout-from-process.html


1

In console tabs, DONT use window.location. The behavior is because, when you open a subtab, the doinit runs before the subtab page opnes up, and as you have used window.location, the url address captures the primary tab url. The only way to be sure to get a subtab url is getEnclosedTabId and getTabURL. Enclosed tab id will return the subtab id, and that ...


2

It looks like you're declaring mapResult but not actually adding any objects to the array, nor adding the styleColor attribute to any of those objects: Assuming your Apex is returning a List of records... this.actualResults = [...result].map(e => { // You may have to "clone" each element in "result" array if you get an immutable ...


0

Your invokeUpdate is server sided code that can only executes on page load. This is why the refresh is necessary in your current setup. As it stands this is your order of operations: enter data on form > button click > form page load with prefilling > update in contrast, you need: enter data on form > button click > update > form page load ...


2

Currently directly navigating to LWC is not possible. So the workaround is to embed the lwc component inside a lightning aura component with interface lightning:isUrlAddressable and navigate to the aura component from visualforce.


0

You have to use Lightning Console JavaScript API for your usecase. Please go through Salesforce Console Developer Guide and learn more about Lightning Console API. The lightning:workspaceAPI component allows you to access methods for programmatically controlling workspace tabs and subtabs in a Lightning console app. For more info, check this link: https://...


0

Attempting to do what you're doing isn't guaranteed to work, as the spec doesn't state what should happen (according to the following link), so browsers have inconsistent behavior. For example, see this issue on github. The behavior seems to currently be undefined in the spec, and non-interoperable in UAs: Chrome does not fire such events, Firefox and Edge ...


0

You need to have onkeydown and onkeyup properties on your input component. This is some code from Aura Lightning component, but you will get the logic and then implement in your LWC component. <input aura:id="lookupInput" class="slds-lookup__search-input slds-input" type="text&...


1

Refresh apex needs to be called on wiredProperty itself, not data. @wire(getApexData, { pageNumber: '$pageNumber' }) wiredInfo(value) { this.wiredApexData = value; if (value.data) { this.apexData = value.data; this.error = undefined; } else if (value.error) { } } now call refresh apex on wiredApexData. refreshApex(this....


0

First of all, considering this is a task which is a part of a course you are taking, it may be worth reaching out to your instructor and asking them for a guideline. It is possible that your instructor may want you to do this once for a single product (not for the whole catalog), so that you can understand that changes you need to do in the Business Manager. ...


1

To use require(), you need to include requirejs. However, that's apparently not your problem. If it's just one user, check to see if jQuery is 404'ing, what browser they're using, etc. My immediate guesses are that they're on IE 11 or something, or a firewall/antivirus issue. Just to verify, I tested your code in a modern browser and it works fine on my ...


0

when you query input right after you switched the tab i think the element is stil not available in dom at that time you can put a timeout and then query input inside like this handleTabSwitch(event) { setTimeout(()=>this.template.querySelector('[data-advance-filter = "checkbox"]').checked=false); }


1

When you set showDiv, the system needs time to redraw the elements, which don't happen in real time. You need a short breather for the DOM to catch up: focusAnchor() { this.showDiv = true; setTimeout(()=>this.template.querySelector('[data-id="myFocussedLink"]').focus()); } P.S. [data-id="${myFocussedLink}"] is trying to ...


1

That's not what templates are used for, as stated by @itzmukeshy7; you can only use this mechanism to select which template you want to use, which is ideal for complicated layouts or components that would otherwise exceed the 128k maximum file size. Instead, you have to query something that's already rendered in the DOM if you want to create a PDF. However, ...


0

For anyone looking for an anwer. The following works Component: <aura:iteration items="{!v.colData}" var="obj" indexVar="index"> <lightning:input type="text" name="{!index}" value="{!obj}" label="Lightning Input" onchange="{!c.update}"/> </aura:...


1

Using a third-party library with LWC has some rules to be followed due to locker services. First of the third-party library has to make sure to expose a global function attached to the window object. I am using the Moment.js found here, and seems perfectly compatible with the Locker. Now I am not sure why we need Promise.all[] since we are not loading ...


0

I don't think it's possible at the moment. I usually have my components in a wrapper component and hide/display, instead of navigating, using if templates in HTML. And I pass the data from one component to the other via events and event handlers. Note: You are reassigning the value of public property and should be avoided.


0

The errors don't get cleared in the first click because the element's values are still intact eventhough you are setting start_date and end_date to null. A workaround would be to put a delay and wait for the input values to change and report validity after the function finishes. handleClear() { this.start_date = null; this.end_date = null; ...


4

If an error occurs at any point in the then handler, this will cause the catch block to execute. That means if there's a problem with showToast or closeModal, you'll get to the catch block all the same. To understand why, consider the alternative form of your code: async handleAddRows(event) { if (this.selectedSubjTemplate.length > 0) { this....


Top 50 recent answers are included