Gday, As for your first eror on function init, be sure to type it with a return type of void -- function init():Void --
Regarding the mx:columns error, I'm assuming you are including the mx namespace where you are using your PagedDataGrid as well. For a reference of an extended datagrid, take a look at Jim Liang's WG DataGrid http://www.mail-archive.com/[email protected]/msg06733.html Cheers, Andrew Spaulding www.flexdaddy.info --- In [email protected], "sanjayd" <[EMAIL PROTECTED]> wrote: > Can somebody please post some sample code (or a link to sample code) > that extends DataGrid..or, maybe, somebody can look at this code (see > below), and tell me how to fix these compile errors: > > > ------------------------ the error ------------------------------ > 1 Error, 1 Warning found. > > Warning /PagedDataGrid.as:21 > The function, init, hides a function in ancestor class, > 'mx.controls.DataGrid'. The return type, no type, is not assignable to > the return type, Void. To override a function, the parameter types and > return type must be assignable to the parameter types and return type > of the overridden function. > > > Error /Rates.mxml:138 > Don't know how to parse element > "http://www.macromedia.com/2003/mxml:columns". It is not a known type > or a property of PagedDataGrid. > > > > ------------------ PagedDataGrid.as --------------------------- > import mx.controls.DataGrid; > import mx.controls.List; > import mx.controls.gridclasses.DataGridColumn; > import mx.controls.gridclasses.DataGridRow; > import mx.effects.Tween; > > > class PagedDataGrid extends DataGrid > { > > > function PagedDataGrid() > { > } > > > > > > function init() > { > super.init(); > } > > > // Scoped to the cell editor. listOwner is the grid > function editorKeyDown(Void) : Void > { > > if (Key.isDown(Key.ESCAPE)) { > this.listOwner.disposeEditor(); > } else if (Key.isDown(Key.ENTER) && Key.getCode() != 229) { > > this.listOwner.editCell(); > this.listOwner.findNextEnterCell(); > }else if(Key.isDown(Key.UP) || Key.isDown(Key.DOWN)){ > > > this.listOwner.editCell(); > this.listOwner.findNextUpDownCell(); > > > } > } > > > > // find the next cell within the row from the currently edited cell, > and focus it. > function findNextUpDownCell(Void) : Void > { > > // modify direction with SHIFT (up or down) > var incr : Number = (Key.isDown(Key.UP)) ? -1 : 1; > var newIndex : Number = __focusedCell.itemIndex + incr; > // only move if we're within range > if (newIndex<getLength() && newIndex>=0) { > __focusedCell.itemIndex = newIndex; > } > setFocusedCell(__focusedCell, true); > > } > > // find the next cell within the row from the currently edited cell, > and focus it. > function findNextEnterCell(Void) : Void > { > > // modify direction with SHIFT (up or down) > var incr : Number = (Key.isDown(Key.SHIFT)) ? -1 : 1; > var newIndex : Number = __focusedCell.columnIndex + incr; > // only move if we're within range > if (newIndex<columns.length && newIndex>=0) { > __focusedCell.columnIndex = newIndex; > } > setFocusedCell(__focusedCell, true); > > } > > > } > --------------- Rates.mxml ----------------------------------- > Usage: > > <mine:PagedDataGrid id="dgRepoRates" height="100%" width="100%" > headerHeight="40" > dataProvider="{gridElementObjectsArray}" > editable="true"> > > <!-- line #138 --> <mx:columns> > <mx:Array> > <mx:DataGridColumn columnName="secID" > headerText="SecID" > editable="false"/> > <mx:DataGridColumn columnName="secDesc" > headerText="Sec Desc" > editable="false" width="140"/> > <mx:DataGridColumn columnName="secType" > headerText="Sec Type" > editable="false"/> > <mx:DataGridColumn > columnName="fundingMethod" headerText="Funding > Method" editable="false"/> > > </mx:Array> > </mx:columns> > </mine:PagedDataGrid> > > > ------------------------------------------------------------------- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

