I'm trying to implement the new calcite components dropdown menu and can't get it to select any of the value options for the field-select.
Solved! Go to Solution.
According to the doc, we need to listen to the 'calciteDropdownSelect' event on the calcite-dropdown element. In your code you retrieve the selected item information later on, so you can use the 'selectedItems' property to discover this information. Here's a slightly updated version of your CodePen that shows these concepts: https://codepen.io/john-grayson/pen/JjNappM
According to the doc, we need to listen to the 'calciteDropdownSelect' event on the calcite-dropdown element. In your code you retrieve the selected item information later on, so you can use the 'selectedItems' property to discover this information. Here's a slightly updated version of your CodePen that shows these concepts: https://codepen.io/john-grayson/pen/JjNappM
For anyone coming across this and seeing 'selectedItems' forever an empty array, I found this to be the case. The solution I found was to put my calcite-dropdown-items in a calcite-dropdown-group. Nothing else needed beyond that. This was the only way I found to know when/which item is selected in a calcite dropdown.
(@JohnGrayson howdy, been awhile!)