1 Reply Latest reply on Jan 29, 2007 11:45 AM by peterent

    Custom DataProvider


      What's the best way for to build custom DataProviders to use to populate a data grid. I am probably not thinking about this the right way - here is my problem: I have structured data in a object graph in memory (I load some XML and the perform some calculations to build that object structure). Now I need multiple "flat" views over that data.

      In Java I would implement say a TableModel interface (say with getNumCols(), getNumRows() getDataAt(row, col)) and then feed that to a table or whatever. What's the flex approach? Has somebody written an how to somewhere? I can find one which makes me think I am thinking along the wrong lines here ... any pointers are welcome.

      I can of course create an XML or collection and copy all the values in there and use that, but that's not what I want. I want to basically keep the data in the existing structure and just have some code make it look like a flat data provider with rows and columns.


        • 1. Re: Custom DataProvider
          peterent Level 2
          Read the documentation on ListCollectionView, that's what ArrayCollection and XMLListCollection extend. You could either extend this and override the methods or you could create your own class and implement ICollectionView, IList, IMXMLObject interfaces.

          Certainly take a peek at the ListCollectionView.as file and see what you need to do.