[Flex Labs] Customizing the flex datagrid
| drawHeaderBackground(headerBG:UIComponent):void drawRowBackgrounds():void drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void |
Next, comes the actual override code. I have created an AS file named DrawListingsGrid.as in the pkg/controls/ directory of the project. I have added comments as place holders in the areas where adjustments are made.
package pkg.controls import flash.display.DisplayObject; use namespace mx_internal; public class DrawListingsGrid extends DataGrid // embedding an image for the row background // embedding an image for the header background // filling in header with embedded background image
//fill the row background with the embedded image |
In order to use this class, you will need to embed it as a custom component in the MXML file.
| <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:con="pkg.controls.*"> |
Next, you can actually add the component to the stage, by referencing the link from the header:
<con:DrawListingsGrid width="100%" height="100%"> |

This immensely helpful, I hacked it a little bit to work with the AdvancedDataGrid, but most of the work was done for me (by you that is :) Thanks!
Josh
Nice Site!
http://google.com