我有一段时间从与所选DataGrid行关联的XML项中获取我的id值。
这很奇怪,因为我得到的selectedObject XML没有问题,但由于某种原因,我无法从中获取id。
<mx:AdvancedDataGrid dataProvider='{pData}' sortExpertMode="true" id="myDataGrid"
width="100%" height="120" paddingLeft="0" dragEnabled="true"
selectionMode="multipleCells" allowMultipleSelection="true"
keyUp="onSelection(event)" mouseUp="onSelection(event)"
draggableColumns="false" >
private function onSelection(event:Event):void
{
for each(var s:Series in myBarChart2.series){
// initialize/empty dataTipItems of all series.
s.dataTipItems = [];
}
// For each of the selected cells to show multiple data tips at once
var n:int = event.currentTarget.selectedCells.length;
var selectedObject:XML = event.target.data;
var theId = selectedObject.playerStats.id.toString();
请帮帮我。
答案 0 :(得分:0)
我明白了。
// Important note::: The first element of XML is omitted when find this.
currentPlayer = event.target.data;
var theId = currentPlayer.id;