4 Replies Latest reply on Jan 19, 2011 4:30 PM by Flex harUI

    Datagrid/List item highlighting

    istrasci Level 1

      By default, whenever you rollOver/mouseOver (not sure of the difference) an item in a Datagrid or a List, that item is highlighted with the component's rollOverColor.  I'm just wondering if there's any way to do that programmatically.  I haven't been able to find much help on the issue.  For example, suppose I have two DataGrids.  When I rollOver an item in the first DataGrid, I want to highlight the corresponding index in the second one as well.  How can I do this?

       

        - Ian

        • 1. Re: Datagrid/List item highlighting
          Flex harUI Adobe Employee

          You could probably subclass DG and have it call drawItem in the other DG

          • 2. Re: Datagrid/List item highlighting
            saisri2k2 Level 4

            You can do with selectedItem and then invalidate list,

            here when setting in the selectedItem, the item has to be the data of the 2nd data grid where you highlight

            • 3. Re: Datagrid/List item highlighting
              istrasci Level 1

              drawItem looks like:

              protected function drawItem(item:IListItemRenderer,
                                              selected:Boolean = false,
                                              highlighted:Boolean = false,
                                              caret:Boolean = false,
                                              transition:Boolean = false):void

               

              If I override it and make it public, what would I put for the item parameter??

              • 4. Re: Datagrid/List item highlighting
                Flex harUI Adobe Employee

                I wouldn't make it public.  I would have the subclass watch for

                ITEM_ROLL_OVER from the other DG and call the drawItem.  I'm not sure if you

                are going to synchronize scrolling as well.  If you are, then you can

                probably just look up the item from the listItems array based on information

                from the ITEM_ROLL_OVER event.  There are also APIs like indexToItemRenderer

                that may be helpful.