2

I'm having trouble finding documentation on this. Is there a way to bind a Picklist value in the lightning component / aura ui:inputSelect tag? Something as simple as <ui:inputSelect value="{!v.obj.Picklist__c" />?

Otherwise, it looks like the only alternative is to utilize the Javascript controller and do a describe to grab the picklist values, which I would prefer to avoid.

Thanks!

2

2 Answers 2

5

As Mohith implied, you can use the force:inputField component (note, I cant remember if this requires Winter 16) to bind to a Salesforce field, the same way you would in Visualforce.

2
  • It's important to note that you should reference a non null sobject when you use the force:inputField tag. (use the default attribute for instance) Otherwise, you'll get a Internal Server Error when using the tag. Although this still didn't quite work for my use case (the select list was disabled for some reason), marking it as best answer. Commented Oct 12, 2015 at 15:17
  • Yes, passing null values isn't a way to win friends in any situation. Were you able to debug why the list was disabled? Perhaps a FLS issue? Commented Oct 12, 2015 at 16:03
0

No, currently (2016-12-17) there seems to be no alternative to query the schema and do the heavy-lifting yourself.

At this time, force:inputField still does not work. It should be fixed in Spring '17 release. See:

Lightning Components: why force:inputField picklist select renders disabled?

and the Known Issue here: https://success.salesforce.com/issues_view?id=a1p3A0000001BaTQAU

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .