You might be able to get away with what you are trying to do, I'm not sure what the bug you are having is but it's solvable.
After you get your solution working, and if your grid is editable, you will run into a focus bug. For some reason when you prepend a control before the super.createChildren the blue editable focus window will be off by a row. It's not trivial to fix that and in my opinion best to just display your row count in separate box before your grid. You can always encapsulate the ADG as a child to your custom control instead of extending it, I know that's less ideas but keeps things in 1 place. -Tom Gruszowski, Sharply Flexing @ (http://tomek.me) --- In flexcoders@yahoogroups.com, Giuseppe Guarnieri <bepp...@...> wrote: > > Hi all!! > > I've designed an extension of AdvancedDataGrid for incorporating a set > of customer's commitments about tabular data. All works fine but a > single thing: I've the need to (optionally) display the total number of > elements in data provider just above the datagrid, such as: > > Rows: 10/87 > > ---------------------------------- > > | header 1 | header 2 | header 3 | > > ---------------------------------- > > | | | | > > | | | | > > | | | | > > ---------------------------------- > > > I've tried to implement that by adding a "Label child" just above the > datagrid: > > override protected function createChildren() : void { > this._lblNumberOfRows = new Label(); > this._lblNumberOfRows.text = "I'm a try!"; > > this.addChild(this._lblNumberOfRows); > super.createChildren(); > } > > override protected function measure() : void { > super.measure(); > this.measuredWidth = Math.max(this.measuredWidth, > this._lblNumberOfRows.measuredWidth); > this.measuredHeight += this._lblNumberOfRows.measuredHeight; > } > > override protected function updateDisplayList(unscaledWidth:Number, > unscaledHeight:Number):void { > this._lblNumberOfRows.invalidateDisplayList(); > super.updateDisplayList(unscaledWidth, unscaledHeight); > } > > But it seems it doesn't works at all... The label don't get displayed > just as I haven't overridden above methods. > > How can I achieve such task? > I have to keep the inheritance from AdvancedDataGrid because I have to > rewrite all the other functionalities otherwise... A lot of work :S So I > would prefer avoiding to resort to composition of label and datagrid > while inheriting from VBox. > > Thank you very much in advance! >