0

I want to use the lightning-combobox to create a nested select list. Like this.

Combbox Sections

I can build it using Lightning Design System. But hoping there is an easier way to pass the options into the combobox. I've tried setting the options in the tag but that doesn't seem to work.

2 Answers 2

4

you can use the following code in html markup

<label> Relate To </label> <lightning-base-combobox items={items} ></lightning-base-combobox> 

and the following code in Javascript

get items() { return [{ label: 'Group One', items: [{ type: 'option-inline', text: 'Burlington Textiles Corp of America' }, { text: 'Dickenson pic', type: 'option-inline' }] }, { label: 'Group Two', items: [{ text: 'Dickenson pic', type: 'option-inline' }, { text: 'Edge Communications', type: 'option-inline' }] }]; } 

You can try this in playground. enter image description here

4
  • @joshii Are you sure this doesn't work? Since it works for me, check it here: developer.salesforce.com/docs/component-library/tools/… Commented Feb 27, 2019 at 21:16
  • Sorry I deleted my earlier comment because I realized I didn't update my combobox to base-combobox. As already mentioned it doesn't deploy. I get an error "No MODULE named baseCombobox found". Commented Feb 27, 2019 at 21:27
  • ok, strange then that this works in playground but doesn't work in actual org. I think we should open a case with Salesforce to investigate this Commented Feb 27, 2019 at 21:39
  • I expected playground to have the same functionality as exposed to real Organization Commented Feb 27, 2019 at 21:40
0

While this works in Playground, when it is deployed in Core Salesforce, access checks will get in the way.

Playground is not attached to an instance of Salesforce, it is a tool for learning language semantics. While this works in a Standalone LWC environment, it likely will not work when deployed.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.