2

According to the lightning:combobox documentation readonly should be set to false, but in the markup it renders like this:

<input type="text" role="textbox" ... readonly="true" class="slds-input">

What oddly doesn't matter, it is always editable. So when I now try to control it myself:

<aura:application extends="force:slds">
    <aura:attribute name="options" type="List"
                    default="[{'label': 'Foo', 'value': 'bar'}]"/>

    <lightning:combobox label="" name=""  options="{!v.options}" readonly="true"/>
</aura:application>

it results in this error message during rendering:

This page has an error. You might just need to refresh it. Assertion Failed!: "readonly" must either be a public property of lightningCombobox or a global HTML attribute : false

Failing descriptor: {MY_NAMESPACE:myApp}

Am I missing something? or is this feature just not properly implemented yet?

Edit

Half of the attributes of the Options aren't working either!

{'label': 'Foo', 'value': 'bar', 'class': 'whatever', 'selected':true}

class and selected are just ignored.

4
  • That looks like a bug. Anyway, looking at the doc this component is supposed to be based on SLDS combobox, but it actually doesn't look like the same at all: lightningdesignsystem.com/components/combobox You can still try to create a case for that, as it should be working. Nov 23 '17 at 15:30
  • @FabienTaillon Hm weird, you are right, there is no search option or similar. On the right you can select "Readonly", thats what it looks like, but it behaves different.
    – Basti
    Nov 23 '17 at 15:33
  • Maybe it's a first version with only readonly available (which would explain why you can't change this attribute), but it should be stated in the doc. Nov 23 '17 at 19:28
  • 1
    I tried it and am facing the same problem - tried also to downgrade the api version to 40 - the same problem Nov 29 '17 at 7:30
1

As you can read on this reply a good Idea could be use the disabled attribute.

readonly is only available in Summer '18 (v43.0). Note that it doesn't seem to work anyways, so you'll probably want to use disabled for right now.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.