flex 4 在datagrid中 添加了一个checkbox 如何获取所选行的值

publicclassInitData{publicfunctiongetColumnsArray():Array{varcolumnsArray:Array=null;... public class InitData
{
public function getColumnsArray():Array
{
var columnsArray:Array = null;
var _checkBoxCloumn:CheckBoxColumn = new CheckBoxColumn();
_checkBoxCloumn.dataField = "isSelected";
_checkBoxCloumn.headerRenderer = new ClassFactory(CheckBoxHeaderRenderer);
_checkBoxCloumn.itemRenderer = new ClassFactory(CheckBoxItemRenderer);
_checkBoxCloumn.width = 30;
_checkBoxCloumn.sortable = false;
_checkBoxCloumn.draggable = false;

var _nameColumn:DataGridColumn = new DataGridColumn();
_nameColumn.headerText = "姓名";
_nameColumn.dataField = "name";

var _telColumn:DataGridColumn = new DataGridColumn();
_telColumn.headerText = "电话";
_telColumn.dataField = "phone";

var _emailColumn:DataGridColumn = new DataGridColumn();
_emailColumn.headerText = "邮件";
_emailColumn.dataField = "email";

columnsArray =new Array(_checkBoxCloumn,_nameColumn,_telColumn,_emailColumn);
return columnsArray;
}

public function getDataArray():ArrayCollection
{
var dataArray:ArrayCollection = new ArrayCollection;
dataArray.addItem({isSelected:false,name:'Christina Coenraets',phone:'555-219-2270',email:''});
dataArray.addItem({isSelected:false,name:'Joanne Wall',phone:'555-219-2012',email:''});
dataArray.addItem({isSelected:false,name:'Maurice Smith',phone:'555-219-2012',email:'maurice@fictitious.com'});
dataArray.addItem({isSelected:false,name:'Mary Jones',phone:'555-219-2000',email:'mjones@fictitious.com'});
dataArray.addItem({isSelected:false,name:'God Win',phone:'555-219-2005',email:'godwin@fictitious.com'});
return dataArray;
}
}

import Common.YotuoUpload.CheckBoxColumn.InitData;
private function Init():void
{
var initData:InitData = new InitData();
dgUser.columns = initData.getColumnsArray();
dgUser.dataProvider = initData.getDataArray();
}
展开
 我来答
yuanfeixiang0
2013-01-15 · 超过10用户采纳过TA的回答
知道答主
回答量:138
采纳率:0%
帮助的人:40.4万
展开全部
可以在 <mx:DataGrid id="dg" x="10" y="0" width="524" height="236">
<mx:DataGridColumn headerText="内容"
dataField="message" />
</mx:columns>
获取,dg.selecteditem.message
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式