3 Replies Latest reply on Mar 28, 2011 10:52 AM by Flex harUI

    highlight datagrid row

    flairjax Level 1

      Is it possible to hightlight a datagrid row programmatically?

       

      I trying

       

      dg.selectedItem = someObject;

      dg.validateNow();

       

      The row gets selected as far as the data so selectedItem gets selected, but the highlight doesn't show.

       

      TIA

        • 1. Re: highlight datagrid row
          Flex harUI Adobe Employee

          Are you saying the background of the row does not change?  Is someObject

          actually in the dataProvider? (and not a copy or equivalent object)?

          • 2. Re: highlight datagrid row
            flairjax Level 1

            Correct.  The background row highlight to blue does not work. I have my screen with the datagrid where an item is selected. If the user clicks the edit button, while a row is selected it opens an edit screen for the selected item. If the user edits or cancels out it removes the edit screen and shows the datagrid again. When the screen with the datagrid is shown again, the row original selected (via click) is highlighted, state is where it was before showing the edit screen, for a second then the dg seems to redraw. So to fix this, I set the selectedItem to what it was, but the blue highlight won't show.

             

            I did a callLater with the same code, which works perfectly, but happens about 5 to 10 seconds later, which is way to late.

             

            I think the issue is that without callLater, me setting the selectedItem is happening before the DG reloads and redraws even when I wait for creationComplete to fire.

            • 3. Re: highlight datagrid row
              Flex harUI Adobe Employee

              If you are reloading the dataProvider, that might cause it to lose

              selection.