Displaying the row number or index in a spark List

The ItemRenderer class in Flex 4 has an itemIndex property that was added after beta2. You can use this property within your item renderer to display the row number or index of an item in a spark List. The following example demonstrates a List with a custom item renderer that uses this itemIndex property. [...]

You Might Also Like...

  • Creating an alternating item renderer in a Spark List control in Flex 4

    695 readersThe following example shows how you can create a custom item renderer in Flex 4 which repositions elements based on the current item renderer’s index in the data provider using the itemIndex property. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/04/08/creating-an-alternating-item-renderer-in-a-spark-list-control-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_itemIndex_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" [...]

  • Creating an alternating item renderer in a Spark List control in Flex 4 (redux)

    564 readersIn an earlier example, “Creating an alternating item renderer in a Spark List control in Flex 4″, we saw how you could create a custom item renderer in Flex 4 which repositions elements based on the current item renderer’s index in the data provider using the itemIndex property. The following example shows how you can

  • Creating a semi-transparent item renderer on a Spark List control in Flex 4

    598 readersThe following example shows how you can create a semi-transparent item renderer on a Spark List control in Flex 4 by creating a custom Spark List skin and a custom item renderer which sets the alpha property on the selected/hovered states. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/04/06/creating-a-semi-transparent-item-renderer-on-a-spark-list-control-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_alpha_test" xmlns:fx="http://ns.adobe.com/mxml/2009" [...]

  • Removing the rollover and selection highlight on a Spark List control in Flex 4

    866 readersThe following example shows how you can remove the item highlight background on a Spark List control in Flex 4 by setting the itemRenderer property to a custom item renderer with the Boolean autoDrawBackground property set to false. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/04/22/removing-the-rollover-and-selection-highlight-on-a-spark-list-control-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_autoDrawBackground_test" xmlns:fx="http://ns.adobe.com/mxml/2009" [...]

  • Displaying icons in a Spark List control in Flex 4

    810 readersThe following example shows how you can display icons in a Spark List control in Flex 4 by creating a custom item renderer and setting the itemRenderer property. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/04/29/displaying-icons-in-a-spark-list-control-in-flex-4-2/ --> <s:Application name="Spark_List_itemRenderer_icon_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" [...]

  • Setting a custom context menu on a Spark List control item renderer in Flex 4

    1258 readersThe following example shows how you can set a custom context menu on a Spark List control item renderer in Flex 4 by setting the contextMenu property in the item renderer’s dataChange event. <?xml version="1.0"?> <!-- http://blog.flexexamples.com/2010/05/06/setting-a-custom-context-menu-on-a-spark-list-control-item-renderer-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_contextMenu_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" [...]

  • Creating a radio button item renderer on a Spark List control in Flex 4

    1038 readersThe following example shows how you can use a Spark RadioButton control as an item renderer for a Spark List control in Flex 4 by setting the itemRenderer property. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/05/20/creating-a-radio-button-item-renderer-on-a-spark-list-control-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_RadioButton_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" [...]

  • Creating an item renderer with a corner radius on a Spark List control in Flex 4

    564 readersThe following example shows how you can create a custom item renderer with a corner radius on a Spark List control in Flex 4 by setting the cornerRadius property and creating a custom item renderer which sets its autoDrawBackground property to false and draws its own rounded background fill using the radiusX property in the

  • Creating a fancy Spark List control item renderer in Flex 4

    1988 readersThe following example shows how you can create a fancy Spark List control item renderer by setting the itemRenderer property. Full code after the jump. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/01/27/creating-a-fancy-spark-list-control-item-renderer-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_test" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" [...]

  • Adding a delete button in the hovered state of a Spark List control item renderer in Flex 4

    595 readersThe following example shows how you can add a delete button to the hovered state of a Spark List control item renderer in Flex 4 by creating a custom item renderer and listening for the mouseDown event. <?xml version="1.0" encoding="utf-8"?> <!-- http://blog.flexexamples.com/2010/04/09/adding-a-delete-button-in-the-hovered-state-of-a-spark-list-control-item-renderer-in-flex-4/ --> <s:Application name="Spark_List_itemRenderer_hovered_test" xmlns:fx="http://ns.adobe.com/mxml/2009" [...]