Years ago, when I taught Mathematics to both college and high school students, I used to show a fun puzzle that I found online called the Flash Mind Reader. It was a trick that had the students pick a number, then do a quick calculation. The Mind Reader would be able to guess the symbolContinue reading “The Mind Reader”
Category Archives: Lightning Web Components
Using the Lightning Message Service
When working with Lightning Aura Components, if we wanted to communicate between two unrelated components, we used Application Events. With Lightning Web Components, the equivalent to Application events was the Publish Subscribe model, or PubSub for short. This had some drawbacks, as it required developers to download the pubsub class and deploy it to theirContinue reading “Using the Lightning Message Service”
Picklist Filters on a Datatable
With Lightning Web Components, we no longer have to click a button to perform filtering on tables. We can instead use a combination of event handlers and wire methods. Here’s an example of a datatable that filters accounts according to the Industry picklist. Changing the value in the filter automatically refreshes the table to displayContinue reading “Picklist Filters on a Datatable”
Calling a REST endpoint from a Lightning Web Component
Calling a REST endpoint in LWC is similar to how it is handled in Visualforce or in Lightning Aura Components. We can make the callout within our Apex controller, then parse the result in our client side controller, then display the results back to the user within the lightning component. Everyone knows about the magicContinue reading “Calling a REST endpoint from a Lightning Web Component”
Open a modal from a datatable to edit records
If I’m on an account and I want to quickly edit some of the information on my child records, I can create a button next to each record that will open a modal, which will allow me to edit the record and then return to my parent account record. Apex Controller: Javascript controller (contactDataTable.js): HtmlContinue reading “Open a modal from a datatable to edit records”