0 Replies Latest reply on Nov 12, 2010 7:12 PM by zkdytan

    Question regarding headerrenderer inside the AdvancedDataGrid

    zkdytan

      Good day!,

       

      Ran into a bit of complication using the AdvancedDataGrid for Flex. Let me first explain it. My Advanced Data Grid is composed of multiple columns, the dataprovider of the grid is mapped inside an actionscript in the form of an array. I have a button that would add new columns to the grid and another one to delete them. During adding the new column I would initialize a new AdvanceDataGridColumn.

       

      This columns would set the headerrendere as a new type of rendererer (as of this moment its just an mxml file with a label and a checkbox inside) and push it inside the columns array and set it back again to the datagrid.columns attribute. So far this is working fine.

       

      However once I check on the checkbox and press the delete column, an error outputs as null object reference. I would first retrieve the columsn

       

      var columns:Array =  datagrid.columns;

       

      and travers this columns to find which was checked. Upon splicing it or popping it, and setting it back again to the datagrid, the null object reference appears

       

      //travers columsn

      //check for checkbox

      //pop this column

       

      datagrid.columns = columns. Upon checking this error i noticed that it happens inside the advance datagrid class. inside the columnRendererChanged? Where it goes insideto //remove the header renderer

       

      If i remember correctly it tried to remove the child (DisplayObject (item)) , in some similar format. whenever i set the columns it would throw this error probably since the headerrenderer was already removed from the columns of the advanceddatagrid? not exactly sure but i cant seem to move one with this problem.

       

      Any suggestions would be appreciated.