Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(record-picker): add some comments #867

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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` only supports a single target.
// 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
Loading