0

我尝试使用 allowMultipleSelection 属性实现页脚数据网格。但就我而言,它似乎不起作用。你能帮我实现这个功能吗?

谢谢

 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();
        }
    }

}
4

1 回答 1

1

当值始终为 时,您的代码仅在构造函数中检查_footerAllowMultipleSelection和设置。allowMultipleSelectionfalse

allowMultipleSelection在 的 setter 中设置属性footerAllowMultipleSelection。您还可以将 的初始值更改_footerAllowMultipleSelectiontrue

但是你为什么要把它包装在一个 getter 和 setter 中呢?该allowMultipleSelection属性已经是公共的,因此无需在您的子类中提供另一个执行相同操作的属性即可设置它。

于 2012-06-15T15:46:55.000 回答