![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
Hi,
I am very new to Advanced datagrid and can't able to figure out how to render a collection I am getting. The data is look like the Hirarchy bellow. ----games:ListCollectionView ------------ gameTurns: ListCollectionView ---------------------gameOrders:ListCollectionView What I am trying here is displaying them in Hirarchy. The resultHandler i have is like this. private function getGameHistoryResultHandler(e:ResultEvent):void { //Alert.show("getGameHistoryResultHandler (expected GameHistoryDto) : " + e.result); if (! e.result is GameHistoryDto) { Alert.show("Invalid result (expected GameHistoryDto) : " + e.result); return; } // extract game history var gameHistoryDto:GameHistoryDto = e.result as GameHistoryDto; /** gameHistoryData = new HierarchicalData(gameHistoryDto.games); gameHistoryData.childrenField = "gameTurns"; gameHistoryADG.dataProvider = gameHistoryData; */ ////////////////////////////////// var g:Grouping = new Grouping(); g.fields = [new GroupingField("name")]; var gc:GroupingCollection = new GroupingCollection(); gc.source = gameHistoryDto.games;//new ArrayCollection(planets); //gc.grouping = g; // gc.childrenField = "gameTurns"; //gc.childrenField = "gameOrders"; ////gc.childrenField = "gameBids"; //gc.childrenField = "gamePrizes"; gc.refresh(); gameHistoryADG.dataProvider = gc; //gameHistory.dataProvider = e.result; } ////////////////////////////////////////////// The MXML is <mx:AdvancedDataGrid id="gameHistoryADG" dataProvider="{new HierarchicalData(gameHistoryData)}" variableRowHeight="true" width="700" height="500"> <mx:columns> <mx:AdvancedDataGridColumn dataField="name" headerText="Name" width="250"/> <mx:AdvancedDataGridColumn dataField="duration" headerText="Duration" /> <mx:AdvancedDataGridColumn dataField="requiredPlayers" headerText="Required Players" /> <mx:AdvancedDataGridColumn dataField="entranceFee" headerText="Entrance Fee" /> </mx:columns> <mx:rendererProviders> <mx:AdvancedDataGridRendererProvider depth="2" columnIndex="1" columnSpan="0"> <mx:renderer> <mx:Component> <mx:AdvancedDataGrid variableRowHeight="true"> <mx:Script> <![CDATA[ override public function set data(value:Object):void { dataProvider = value; } ]]> </mx:Script> <mx:columns> <mx:AdvancedDataGridColumn dataField="name" headerText="Name" /> <mx:AdvancedDataGridColumn dataField="playerName" headerText="Player Name" /> <!-- <mx:AdvancedDataGridColumn dataField="gameType" headerText="Game Type"/> <mx:AdvancedDataGridColumn dataField="gameStatus" headerText="Game Status"/> <mx:AdvancedDataGridColumn dataField="turnState" headerText="Turn State"/> --> </mx:columns> <mx:rendererProviders> <mx:AdvancedDataGridRendererProvider depth="3" columnIndex="2" columnSpan="0"> <mx:renderer> <mx:Component> <mx:AdvancedDataGrid xmlns="*" xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.collections.GroupingCollection; public var gc:GroupingCollection = new GroupingCollection(); override public function set data(value:Object):void { gc.source = value['gameOrders']; gc.refresh(); dataProvider = gc; } ]]> </mx:Script> <mx:columns> <mx:AdvancedDataGridColumn dataField="name" headerText="Name" /> <mx:AdvancedDataGridColumn dataField="tradeableID" headerText="Tradable ID" /> <mx:AdvancedDataGridColumn dataField="volume" headerText="Volume" /> <mx:AdvancedDataGridColumn dataField="priceOrdered" headerText="Order Price"/> <mx:AdvancedDataGridColumn dataField="priceExecuted" headerText="Executed Price"/> </mx:columns> </mx:AdvancedDataGrid> </mx:Component> </mx:renderer> </mx:AdvancedDataGridRendererProvider> </mx:rendererProviders> </mx:AdvancedDataGrid> </mx:Component> </mx:renderer> </mx:AdvancedDataGridRendererProvider> </mx:rendererProviders> </mx:AdvancedDataGrid> A quick help will be appriciated., Thanks, Srinivas |
| Sponsored Links |
|
|||
|
"SMannava" <webforumsuser@macromedia.com> wrote in message news:gc4uah$8c6$1@forums.macromedia.com... > Hi Can any one help on this Could you be more specific on how what you're getting is different from what you want? |
|
|||
|
Hi Amy,
From the server I am getting a gameDTO GameHistoryDTO { gamesList <GameDTO> } GameDTO{ gameTurnsList<GameTurnDTO> .....other game related attributes } GameTurnDTO{ gameOrdersList<GameOrderDTO> gameBidsList<GameBidDTO> gamePrizesList<GamePrizeDTO> --- other game turn attributes } Now I want to display this collection in Advanced data grid as --Games<GameDTO> ------------GameTurns<GameTurnDTO> --------------------GameOrders<GameOrderDTO> --------------------GameBids<GameBidDTO> --------------------GamePrizes<GamePrizeDTO> In simple terms games has game turns and gameturns has gameorders, gamebids and gameprizes. Please let me know if you need any further details |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise