4 Replies Latest reply on Jul 14, 2011 12:42 AM by DanStarlight

    PopupAnchor on DataGridItem can't get focus

    DanStarlight Level 1

      I have a DataGrid with an itemRenderer on its DataGridColumn.

      The itemRenderer has a label and a PopupAnchor with a button inside.

      I can't set focus to the button.

       

      Main application --> DataGridPopupAnchor.mxml

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
          <fx:Declarations>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
          </fx:Declarations>
         
          <fx:Declarations>
              <fx:XMLList id="employees">
                  <employee>
                      <name>1 Christina Coenraets</name>
                  </employee>
                  <employee>
                      <name>2 Joanne Wall</name>
                  </employee>
                  <employee>
                      <name>3 Maurice Smith</name>
                  </employee>
                  <employee>
                      <name>4 Mary Jones</name>
                  </employee>
                  <employee>
                      <name>5 Christina Coenraets</name>
                  </employee>
              </fx:XMLList>
          </fx:Declarations>

       

          <mx:DataGrid id="dg" color="0x323232" width="100%" height="100%" dataProvider="{employees}">
              <mx:columns>
                  <mx:DataGridColumn dataField="name" headerText="Name" itemRenderer="GridRenderer"/>
              </mx:columns>
          </mx:DataGrid>
      </s:Application>

       

       

       

      DataGridColumn itemRenderer--> GridRenderer.mxml

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                focusEnabled="true">
         
          <s:states>
              <s:State name="normal" />
              <s:State name="hovered"/>
              <s:State name="selected" />
          </s:states>
         
          <s:Label
              text="{dataGridListData.label}"
              />
          <s:PopUpAnchor popUpPosition="center"                           
                         includeIn="hovered"
                         displayPopUp.hovered="true"
                         >
              <s:Button label="click me"/>                      
          </s:PopUpAnchor>
      </s:MXDataGridItemRenderer>