flex 使用dataGrid,在列里面自己加组件

<s:DataGrid width="100%" height="100%" dataProvider="{this.moneyRankingArray}" id="moneyRankingList" requestedRowCount="4" textAlign="center" ><s:columns><s:ArrayList><s:GridColumn headerText="名次" dataField="places" rendererIsEditable="true" /><s:GridColumn headerText="用户昵称" dataField="userNick" ><s:itemRenderer><fx:Component><s:GridItemRenderer><mx:LinkButton label="{data.userNick}" id="link" click="outerDocument.showMoneyRankingMenuBar(event,data)" /></s:GridItemRenderer></fx:Component></s:itemRenderer></s:GridColumn><s:GridColumn headerText="金币" dataField="money" /><s:GridColumn headerText="状态" dataField="stateDes" /></s:ArrayList></s:columns></s:DataGrid>

click="outerDocument.showMoneyRankingMenuBar(event,data)"

这里的event,可以自定义传事件的event
			 public function showMoneyRankingMenuBar(event:MouseEvent,obj:Object):void{   
				var moneyRanking:MoneyRankingVO = obj as MoneyRankingVO;
				if(moneyRanking.state == 0){
					return;					
				}
				if(moneyMenuBar == null){
					moneyMenuBar = RankingMenu.create(null, moneyRankingMenuData, false);
					moneyMenuBar.labelField="@label";
					moneyMenuBar.addEventListener("itemClick",handleMoneyRanking);
				}
				moneyMenuBar.moneyRanking = moneyRanking;
				moneyMenuBar.show(event.stageX, event.stageY);
			 }





   

你可能感兴趣的:(Flash)