2 Replies Latest reply on Sep 6, 2011 10:16 AM by Flex harUI

    spark datagrid GridItemRenderer   Cannot access a property or method of a null object reference

    Julian Montes

      Hi

      I have created a spark datagrid  with a  griditemrender,  but, when  my application  start and  dataprovider  is  null, and  not have  data.

       

      Has the error

       

      "Cannot access a property or method of a null object reference"

       

      when have data  dont have problem

       

      I was  used for the griditemrender :

       

      prepare  method ,   updateComplete, creationComplete, and all them have the same  error  on aplication  starts

       

      any idea  from   this error?

       

      +++  my itemrender  +++++

       

      <?xml version="1.0" encoding="utf-8"?>

       

      <s:GridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"

       

                                xmlns:s="library://ns.adobe.com/flex/spark">

       

          <fx:Script>

       

              <![CDATA[

       

                  override public function prepare(hasBeenRecycled:Boolean):void

       

                  {

       

                      valueDisplay.selected = data[column.dataField] as Boolean;

       

                  }

       

              ]]>

       

          </fx:Script>

       

          <s:CheckBox id="valueDisplay"/>

       

      </s:GridItemRenderer>