Sunday, November 21, 2010

Nested AdvancedDataGrid

Flex them Grids! (AdvancedDataGrid as a subgrid with flat data)

A grid inside a grid is a common requirement; I thought. Yet, I scoured the internet for a solution and I couldn’t find it anywhere (…at least not something that could be done with “flat data”). The following is something I wanted to achieve.


Adobe LiveDocs show an example here http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7bf2.html where they put a chart in an itemrenderer. However they show this example with “Hierarchical” collection. Their data structure looks like:
   1: [Bindable]
   2:      private var dpHierarchy:ArrayCollection= new ArrayCollection([
   3:        {name:"Barbara Jennings", region: "Arizona", total:70, children:[  
   4:          {detail:[{amount:5},{amount:10},{amount:20},{amount:45}]}]},
   5:        {name:"Dana Binn", region: "Arizona", total:130,  children:[ 
   6:          {detail:[{amount:15},{amount:25},{amount:35},{amount:55}]}]},
   7:        {name:"Joe Smith", region: "California", total:229,  children:[ 
   8:          {detail:[{amount:26},{amount:32},{amount:73},{amount:123}]}]},
   9:        {name:"Alice Treu", region: "California", total:230, children:[ 
  10:          {detail:[{amount:159},{amount:235},{amount:135},{amount:155}]}
  11:        ]}
  12:      ]);      

However, this is almost never how one would get data from the server. We generally get a flat data-structure as ArrayCollection. The the trick would be to convert this flat structure into a Hierarchy of objects.

Wednesday, November 10, 2010

…and take that too Times of India

I noticed lots of downloads for times of india source code. If you would be so kind to leave a comment...it will be greatly appreciated.



I‘ve compiled an Android app to read the newspaper ad-free. It’s the same concept as before, but I have to parse the incoming HTML with regex (I hate RegEx….I spent so much time with it).
I’m well into the night, so I’ll skip the explanation and but do enjoy the screenshots.