2 Replies Latest reply on Dec 6, 2007 6:19 PM by ntsiii

    RowIndex as DataGridColumn value

      Is it possible to have the rowIndex of the datagrid showed in a column ?

      I know that I can always add my dataprovider an id column but I would like to skip that!

      Any ideas? How about using an item renderer or something like that?
        • 1. Re: RowIndex as DataGridColumn value
          m_hartnett Level 3
          Here is how I did it. This is based on a number of articles I have read on renderers and I have not completed it yet meaning that I am not sure this is the most effecient / correct use of the renderer. I am not sure the use of the Render event is correct.

          Anyway, it will give you row numbers.

          <?xml version="1.0" encoding="utf-8"?>
          xmlns:mx=" http://www.adobe.com/2006/mxml"
          implements="mx.controls.listClasses.IDropInListItemRenderer, mx.core.IFactory">


          import mx.controls.listClasses.BaseListData;

          private var _listData : BaseListData;

          public function initializeHandler() : void {
          this.addEventListener("render", refreshData );

          public function newInstance():* {
          return new RowNbrRenderer();

          public function get listData() : BaseListData {
          return _listData;

          public function set listData( value : BaseListData ) : void {
          _listData = value;

          override public function set data(value:Object):void {
          super.data = value;

          public function refreshData( e:Event ):void {

          if(data == null) return;

          statusText.text = this.listData.rowIndex.toString();



          <mx:Label id="statusText" width="100%" height="18" x="16"/>

          • 2. Re: RowIndex as DataGridColumn value
            ntsiii Level 3
            You can also use labelFunction if your dataProvider is a collection: