Hi,

i create a class that extends datadrid

package actionscriptcomponent
{
        import mx.controls.DataGrid;

        public class CustomDataGrid extends DataGrid
        {       
                
                private var _nrows:uint = 6;
                
                private var _ncolumns:uint = 7;
                
                private var rowsChanged:Boolean = false;
                
                private var columnsChanged:Boolean = false;
                
                public function CustomDataGrid()
                {
                        super();
                }
                
                public function set nrows(value:uint):void {
                        if(nrows != value){
                                _nrows = value;
                                rowsChanged = true;
                                invalidateProperties();
                        }
                }
                
                public function get nrows():uint {
                        return _nrows;
                }
                
                public function set ncolumns(value:uint):void {
                        if(ncolumns != value){
                                _ncolumns = value;
                                columnsChanged = true;
                                invalidateProperties();
                        }
                }
                
                public function get ncolumns():uint {
                        return _ncolumns;
                }
                
                override protected function commitProperties():void {
                        if(rowsChanged)
                                rowCount = nrows;
                        if(columnsChanged)
                                columnCount = ncolumns;
                }
        }
}

the i would lsiten for change for rows and columns numeber...
for example, my default grid have 6 rows and 7 columns...
then at run time i would have a grid that have 8 rows and 10 columns...
is it the right way?

Thanks a lot

Regards Lorenzo

Reply via email to