Skip to content

Commit

Permalink
add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arosenbach committed Oct 25, 2023
1 parent 0e988eb commit 114a54f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<label class="slds-form-element__label">Select a record</label>
<div class="slds-form-element__control slds-combobox-group">
<template if:true={showTargetSelector}>
<!-- Target selector -->
<lightning-combobox
data-id="targetSelector"
label="Select a target sObject"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { LightningElement } from 'lwc';

// As of today, `lightning-record-picker` supports a single targets.
// This sample component shows how you can turn `lightning-record-picker` into
// a multi-target record picker, where the user can select the target object
// before searching.
export default class RecordPickerDynamicTarget extends LightningElement {
targetObjects = [
{
Expand Down Expand Up @@ -45,6 +49,9 @@ export default class RecordPickerDynamicTarget extends LightningElement {
}

handleTargetSelection(event) {
// Prevent lightning-combobox `change` event from bubbling
event.stopPropagation();

this.selectedTarget = event.target.value;
this.refs.recordPicker.clearSelection();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export default class RecordPickerHello extends LightningElement {
this.selectedRecordId = event.detail.recordId;
}

// A GraphQL query is sent after the record picker change event has been dispatched.
// This is the recommended practice for fetching record fields based on
// the record picker change event's recordId.
@wire(graphql, {
query: gql`
query searchContacts($selectedRecordId: ID) {
Expand Down

0 comments on commit 114a54f

Please sign in to comment.