function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
heiriticheiritic 

is apex datatable support viewing from array of list rather than query result ?

Hi all,

I want to make datatable with the value from array of list. I believe it is List<string>. Can I do that ?
What I want is the datatable can dynamicly change the column value, for instance, column A populated with contact.account.name or column A populated with contact.Name. Meaning column A can have the value of the childnodes from the contact or the name field from contact.
Is it possible to do that ? any suggestion would be great

regards,
edwin
Sam.arjSam.arj
Create an Apex class with fields that you need (even if one field is only required) then fill it up by a loop or any other means that you can and then have datatable view it.

Code:
public class myClass
{
   public string name
   {
      get;
      set;
   }
   public myClass(string name)
   {
      this.name = name;
   }
}


public class Controller
{
  private List<myClass> names;
  
  //datatable value="{!names}"
  public List<myClass> getNames()
  {
     return names;
  }

  ......
}



 


heiriticheiritic
that's cool Sam.arj. Great thinking. I've never thought about this. I still need more practices. :smileyhappy:


regards,

edwin