1 Reply Latest reply on Oct 9, 2008 7:37 AM by Newsgroup_User

    Problems Creating an Item Editor

    ericbelair Level 1
      I'm trying to implement an Item Renderer and Item Editor for my DataGrid.

      The DataGrid has an ArrayCollection as its DataProvider. Each item in the Collection is a Value Object (named "CustomItem") with the following properties:

      public var idNmb:int;
      public var name:String;
      public var objectType:CustomType

      The CustomType Class is another Value Object with the following properties:

      public var idNmb:int;
      public var name:String;

      The DataGrid has two columns. The first column displays the CustomItem name - no renderer or editor.

      I want the second column to display the "name" property of the CustomItem's CustomType property, or a default value if no CustomType is set. My ItemRenderer does this fine (see attached). However, I can't get my ItemEditor to work without throwing run-time errors.

      As is, I get the following RTE when I try to edit the item:

      ReferenceError: Error #1069: Property text not found on CustomItemEditor and there is no default value.
      at mx.controls::DataGrid/itemEditorItemEditEndHandler()[E:\dev\3.0.x\frameworks\projects\fra mework\src\mx\controls\DataGrid.as:4807]

      So, I added a property called "text" to my ItemEditor (public var text:String;), which doesn't throw that error.

      However, now I get this RTE:

      ReferenceError: Error #1069: Property null not found on valueObjects.CustomItem and there is no default value.
      at mx.controls::Button/set data()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\Button.as:873]
      at view.composite.categorizeSecurities::AssetStyleItemEditor/set data()[CustomItemEditor.as:16]

      The error is being thrown at the line sets super.data to item.

      Please help...
        • 1. Re: Problems Creating an Item Editor
          Level 7

          "ericbelair" <webforumsuser@macromedia.com> wrote in message
          news:gcl4bg$kom$1@forums.macromedia.com...
          > I'm trying to implement an Item Renderer and Item Editor for my DataGrid.

          Try setting a break point right here and inspect your customItem variable
          and see what is in it. Also try stepping over the code. That sometimes
          gives insight.

          > this.label = "Uncategorized";
          >
          > if (customItem.customType != null)
          > Menu(this.popUp).selectedItem =
          > customItem.customType;
          >
          > super.invalidateDisplayList();
          > }
          > }
          > }
          > }
          > }
          >