Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
smscentral #1
checkbox rendere in datagrid
Hi all,
I have a datagrid with checkbox as renderer.
after selecting few checkboxes,if i scroll the datagrid selection doesnot
remain..
my renderer code is attached..
Any help would be great..
thanks
public class DatagridCheckboxRendererAS extends CheckBox
{
public function DatagridCheckboxRendererAS(){
super();
}
override public function set data(value:Object):void{
if(value != null){
super.data = value;
}
}
/*check if user has delete permission */
public function checkDelPermission():Boolean{
var checkpermissioninstance:CheckPermission = new CheckPermission();
checkpermissioninstance.permissions = [8];
if(data.hasOwnProperty("permission")){
checkpermissioninstance.permBit = data.permission;
var delpermission:ArrayCollection =
checkpermissioninstance.getPermissions()
if(delpermission!=null){
if(delpermission[0]==true){
return true;
}
else{
return false
}
}
}
return false;
}
override protected function
updateDisplayList(unscaledWidth:Number,unscaledHei ght:Number):void
{
super.updateDisplayList(unscaledWidth,unscaledHeig ht);
if(checkDelPermission())
this.visible = true;
else
this.visible=false;
}
override public function validateProperties():void{
super.validateProperties();
if (listData)
{
var dg:DataGrid = DataGrid(listData.owner);
var column:CheckBoxHeaderColumn = dg.columns[listData.columnIndex];
column.addEventListener("click",columnHeaderClickH andler);
}
}
//click handler for checkbox renderers in each row
override protected function clickHandler(event:MouseEvent):void{
super.clickHandler(event);
var dg:DataGrid = DataGrid(listData.owner);
var data : Object = dg.dataProvider[listData.rowIndex-1];
var dataObj :Object = {id:data.id,check:event.target.selected};
parentDocument.toggleSelectedData(dataObj);
invalidateProperties();
}
//click handler for the header checkbox of datagrid column
private function columnHeaderClickHandler(event:MouseEvent):void{
selected = event.target.selected;
var dg:DataGrid = DataGrid(listData.owner);
//the first header row has its index as neagtive value.Exclude the header
row.
if(dg.itemRendererToIndex(this) >= 0){
if(this.visible){
Alert.show(""+dg.itemRendererToIndex(this))
var data:Object = dg.dataProvider[dg.itemRendererToIndex(this)];
var dataObj :Object = {id:data.id,check:event.target.selected};
parentDocument.toggleSelectedData(dataObj);
}
}
}
smscentral Guest
-
CheckBox in Datagrid
Hello can anyone help me for displaying a checkbox into datagrid. thanks -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
how to add checkbox to a datagrid?
Hello, I am trying to add a checkbox to a datagrid. But i dont want to bind a data with the checkBox. I only want to know if any user has chacked... -
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False
I have created a Template Column and Added to a Datagrid, which contains a checkBox. The column is not Binded to any column of the Dataset, but is... -
DataGrid&CheckBox
I have a problem with handle an exception on DataGrid - TemplateColumn I have a datagrid with many columns. One of them is itemID. Second is...



Reply With Quote

