I try to implement footer datagrid with allowMultipleSelection properties.
But in my case, it seems not to work.
Can you help me to implement this function.
Thanks
package fr.component.dgFooter
{
import mx.controls.DataGrid;
import mx.controls.dataGridClasses.DataGridColumn;
public class FooterDataGrid extends DataGrid
{
protected var _footerAllowMultipleSelection:Boolean=false;
public function FooterDataGrid()
{
super();
if(_footerAllowMultipleSelection){
this.allowMultipleSelection=true;
}
else{
}
}
public function get footerAllowMultipleSelection():Boolean
{
return _footerAllowMultipleSelection;
}
public function set footerAllowMultipleSelection(value:Boolean):void
{
_footerAllowMultipleSelection = value;
}
protected var footer:DataGridFooter;
protected var footerHeight:int = 22;
override protected function createChildren():void
{
super.createChildren();
if (!footer)
{
footer = new DataGridFooter();
footer.styleName = this;
addChild(footer);
}
}
override protected function adjustListContent(unscaledWidth:Number = -1,
unscaledHeight:Number = -1):void
{
super.adjustListContent(unscaledWidth, unscaledHeight);
listContent.setActualSize(listContent.width, listContent.height - footerHeight);
//this deals w/ having locked columns - it's handled differently in
//the dg and the adg
footer.setActualSize(listContent.width+listContent.x, footerHeight);
footer.move(1, listContent.y + listContent.height + 1);
}
override public function invalidateDisplayList():void
{
super.invalidateDisplayList();
if (footer)
footer.invalidateDisplayList();
}
}
}
Your code only checks
_footerAllowMultipleSelectionand setsallowMultipleSelectionin the constructor, when the value is alwaysfalse.Set the
allowMultipleSelectionproperty in the setter offooterAllowMultipleSelection. You can also change the initial value of_footerAllowMultipleSelectiontotrue.But why are you wrapping it in a getter and setter at all? The
allowMultipleSelectionproperty is already public, so it can be set without providing another property in your subclass that does the exact same thing.