3 Replies Latest reply on Dec 21, 2011 12:47 AM by Claudiu Ursica

    isItemHighlighted isItemSelected flex 4




      my goal is to migrate my application from flex 3.2 to flex 4.5.

      So, i have the following properties in the actionScript part :





      But spark.components.DataGrid component we don't have these properties, could you give me please the equivalent of these two properties ?



      Thanks in advance

        • 1. Re: isItemHighlighted isItemSelected flex 4
          Flex harUI Adobe Employee

          You can check the currentState of the renderer.

          • 2. Re: isItemHighlighted isItemSelected flex 4
            kaissun Level 1

            How ? i don't understand what you mean. Can you give me some code ?

            • 3. Re: isItemHighlighted isItemSelected flex 4
              Claudiu Ursica Level 4

              Presumably you are using a custom itemRenderer and it extends ItemRenderer you have these states out of the box:



                  protected function getCurrentRendererState():String


                      // this code is pretty confusing without multi-dimensional states, but it's

                      // defined in order of precedence.


                      if (dragging && hasState("dragging"))

                          return "dragging";


                      if (selected && down && hasState("downAndSelected"))

                          return "downAndSelected";


                      if (selected && showsCaret && hasState("selectedAndShowsCaret"))

                          return "selectedAndShowsCaret";


                      if (hovered && showsCaret && hasState("hoveredAndShowsCaret"))

                          return "hoveredAndShowsCaret";


                      if (showsCaret && hasState("normalAndShowsCaret"))

                          return "normalAndShowsCaret";


                      if (down && hasState("down"))

                          return "down";


                      if (selected && hasState("selected"))

                          return "selected";


                      if (hovered && hasState("hovered"))

                          return "hovered";


                      if (hasState("normal"))   

                          return "normal";


                      // If none of the above states are defined in the item renderer,

                      // we return currentState, so we don't change the state just

                      // in case the developer put the item renderer into its

                      // own custom state.

                      return currentState;



              So in your code you ca check whatever state is the renderer in, that will tell you if the item is selected or not.



              1 person found this helpful