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();
} 展开
{
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();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询