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!

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.

  • 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. – James Loghry Oct 12 '15 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? – Christian Carter Oct 12 '15 at 16:03
1

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

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.