• Shaik naina 5
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Is there any way of displaying a picklist within an aura datatable?

I've read that only certain data types can be used within a datatable, but there must be a way of displaying a picklist or something similar where the user can select a value from a list of values?

Anybody managed to do this?
 
  • November 28, 2019
  • Like
  • 0
I need help writing a test that contains Schema.PicklistEntry I have looked everywhere and cant figure this out, i am new to Apex so any help would be greatly appreciated. below is the method, which returns all picklists and values on the specifed object.

   
    public static List <String> getselectOptions(sObject objObject, string fld) {
        system.debug('objObject --->' + objObject);
        system.debug('fld --->' + fld);
        List < String > allOpts = new list < String > ();

        Schema.sObjectType objType = objObject.getSObjectType();        
   
        Schema.DescribeSObjectResult objDescribe = objType.getDescribe();        
    
        map < String, Schema.SObjectField > fieldMap = objDescribe.fields.getMap();        
      
        list < Schema.PicklistEntry > values =
            fieldMap.get(fld).getDescribe().getPickListValues();        
     
        for (Schema.PicklistEntry a: values) {
            allOpts.add(a.getValue());
        }
        system.debug('allOpts ---->' + allOpts);
        allOpts.sort();
        return allOpts;
    }