title: how to create a dynamic datagrid in flex
body: <p>I am trying to create a datagrid in FLEX. The trouble is that I want it to be 100% dynamic - i.e. columns &amp; data.</p>
  
  <p>Basically I need to populate the datagrid via a result set from a database query, this data will be gathered via a standard java spring jdbc dao layer. The query is as generic as 'select * from tablename', so the result set can change from query to query.</p>
  
  <p>My plan is to convert this result set into some form of java object, my initial thought is a Map of some kind that will contain the column name and values for a row.</p>
  
  <p>The bit Im struggling with is that I need to convert this result set into a ActionScript object (via graniteds) that I can then use to populate a datatable.</p>
  
  <p>I have seen lots of examples on how to dynamically add columns to the datagrid, and tie in the data via the datafield object - but Im stuck as to how I do this if I dont know how many columns I will have or what the column names will be.</p>
  
  <p>hope this makes sense.</p>
  
  <p>Thanks</p>