0

I have a use case in a Lightning Component where I have to select the values in a dropdown by setting element’s selected property to true in the code as follows.

options.forEach(function(element) {
     element.selected = true;
});

Actually when the user selects the element in the dropdown, I am displaying an check icon before that selected value. But the icon is not displayed when I set the element's property to true through code the UI is not updated.

If I select the other value along with the selected element in code, then the bot the elements are selected and also displayed with the check icon.

So the UI is updated with selected values only when user clicks on that element, but not when set to true in code. Any ideas would be appreciated.

  • can you add more component code / or explains with pictures – sdandamud1 Jan 8 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.