Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-26528

ItemRenderer.itemIndex should return -1 when rendering the typicalItem

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Later
    • Adobe Flex SDK 4.5 (Release)
    • None
    • Spark: DataGroup
    • None
    • Affected OS(s): All OS Platforms
      Affected OS(s): All OS Platforms
      Language Found: English

    Description

      Sometimes you need to be able to distinguish between the typicalItem and a normal data item in a spark ItemRenderer. It would be nice if itemIndex returned -1 instead of 0 when rendering the typicalItem.

      For example:

      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark">

      <s:List>
      <s:dataProvider>
      <s:ArrayList>
      <fx:String>0</fx:String>
      <fx:String>1</fx:String>
      <fx:String>2</fx:String>
      </s:ArrayList>
      </s:dataProvider>
      <s:itemRenderer>
      <fx:Component>
      <s:ItemRenderer>
      <fx:Script>
      <![CDATA[
      override public function set data(value:Object):void

      { super.data = value; trace("itemIndex:", itemIndex, "data:", data); }

      ]]
      >
      </fx:Script>
      <s:Label text="

      {data}

      " />
      </s:ItemRenderer>
      </fx:Component>
      </s:itemRenderer>
      </s:List>

      </s:Application>

      Actual Results:

      itemIndex: 0 data: 0
      itemIndex: 0 data: 0
      itemIndex: 1 data: 1
      itemIndex: 2 data: 2

      Expected Results:

      itemIndex: -1 data: 0
      itemIndex: 0 data: 0
      itemIndex: 1 data: 1
      itemIndex: 2 data: 2

      I'm not sure if this is a popular use case, but it is something that caused me some pain in building some QA automation in combination with SDK-28709.

      Attachments

        Activity

          People

            adobejira Adobe JIRA
            adobejira Adobe JIRA
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: