Random shot, try importing mx.controls.Text and mx.controls.TextInput?  I think it should have been a compiler error if it was necessary but…

 

Note that the error is for the item editor when you say it’s the renderer that you change to fix it.  Sounds like a bug to me…  I’ll forward it inside.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Scott Romer
Sent: Thursday, April 27, 2006 2:41 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Null error when using specifying itemRenderer on dataGridColumn

 

I've been struggling for some time now (and I'm assuming this must just be so brain-dead simple)...
Trying to set an ItemRenderer and ItemEditor on a datagridColumn.  For certain ItemRenderer's, I am getting a null error.  (using Flex 2 beta 2)

NOTE: I am not trying to use these as my actual renderer and editor classes as they don't really provide anything at all above the defaults.. but I noticed this gives the EXACT same error.  (My actual renderer extends from Canvas...)

If you change the itemRenderer to mx.controls.Label, then it works fine.. and oddly enough Text extends Label.    Any ideas?



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    backgroundAlpha="0" creationComplete="initApp()">

<mx:Script>
    <![CDATA[
    &! nbsp;   import mx.collections.ArrayCollection;  
    
        [Bindable]
        public var dataProvider:ArrayCollection;

        private function initApp():void
        {
            dataProvider = new ArrayCollection([
                        {name: "John Smith", dept: "Engineering"},
                        {name: "Jane Doe", dept: "Marketing"},
                        ! {name: "Lisa Brown", dept: "Sales"},
   &nbs! p;                     {name: "Robert Wong", dept: "Engineering"},
                        {name: "Amy Taylor", dept: "Finance"},
                        ]);
        }
       
    ]]>
</mx:Script>

<mx:DataGrid id="myDatagrid" dataProvider="{dataProvider}"
    variableRowHeight="true" editable="true" rowHeight="50"
    width="300" height="300">
    <mx:columns>
        <mx:DataGridColumn dataField="name"/>
     &! nbsp;  <mx:DataGridColumn dataField="dept" editable="true"
            itemRenderer="mx.controls.Text" editorDataField="text" itemEditor="mx.controls.TextInput">
        </mx:DataGridColumn>
    </mx:columns>
</mx:DataGrid>

</mx:Application>




Null error received when trying to edit the dept column:
TypeError: Error #1009: null has no properties.
    at mx.controls::DataGrid/createItemEditor()
    at mx.controls::DataGrid/itemEditorItemEditBeginHandler()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.controls::DataGrid/commitEditedItemPosition()
    at mx.controls::DataGrid/mx.controls:DataGrid::updateDisplayList()
    at ! mx.core::UIComponent/validateDisplayList()
  &nbs! p; at mx .managers::LayoutManager/validateDisplayList()
    at mx.managers::LayoutManager/::doPhasedInstantiation()
    at mx.core::UIComponent/::callLaterDispatcher2()
    at mx.core::UIComponent/::callLaterDispatcher()




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to