Search This Blog

Monday, March 28, 2011

Flex access dataGrid from ItemRenderer

If you have a buttonClickCall in your DataGrid and you want to access the whole DataGrid from your ItemRenderer call do the following:

add imports:

import mx.controls.DataGrid;
import mx.core.Application;
import mx.core.FlexGlobals;

access DataGrid in the following way:

var dataProvider = FlexGlobals.topLevelApplication.dataGrid.dataProvider;
var dataProvider = Application.application.dataGrid.dataProvider;


It will work despite the fact that these DataGrid variable is defined in a different mxml file.

ItemRenderer – ItemRendererXXX.mxml
Application – Name_Of_Your_App.mxml


You can that access all items in the following way:

for (var i:int = 0; i < dataProvider.length; i++)
    item = dataProvider.getItemAt(i);


  1. Its not working for me pls add some codes with this so that i can understand.

  2. This comment has been removed by a blog administrator.

  3. _listData.owner as AdvancedDataGrid

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

    public override function set listData(value:BaseListData):void{
    _listData = value as AdvancedDataGridListData;
    column = _listData ? AdvancedDataGrid(_listData.owner).columns[_listData.columnIndex] as GridColumnMXTA : null;



If you like this post, please leave a comment :)