This content has been marked as final. Show 3 replies
Assuming that you've received the SOAP response and are ready to process the data to show in the grid:
1) You would have a DataGrid somewhere in your application with an ID assigned to it.
2) First you'll process rowheader stanza and instanciate DataGridColumn class for each column setting it's name and dataField properties.
3) keep adding DataGridColumns to an Array
4) assign this array to the columns property of the DataGrid
5) now you'll start processing data rows; you'll use ArrayCollection or XMLCollection classes to add each row to the collection. The collection, obviously, would be [Bindable]
6) Once you've all the rows in the collection you'll set this to the dataProvider property of the Grid, if no already set statically in the DataGrid tag.
Can the metadata also be read in dynamically? Perhaps from an attribute in the xml response.
i.e Whether or not the column holds String vs. Numeric data?
Yes, simply change ATTA's #2 to something like:
2)Access the metadata node, loop over the column definition child nodes and instantiate a DataGridColumn for each ...
If you want to see a simple exampl of dynamic columns, I have one on www.cflex.net, search for dynamic column. It uses the implicit structure of the data, not metadata, but the theory will be the same.