0 Replies Latest reply on Jun 22, 2011 9:42 AM by bon_t

    How to get value of "selected" column in AdvancedDataGrid


      Hi All,

      I'm using an AdvancedDataGrid component in ActionScript 3, Flex 4.

      The grid has 5 columns: Caller Intent, Labels, Strategy, Confirmation  Mode, and Confirmation Promptlet. All columns are editable except for  the Labels column.



      I associated the following method to the itemClick event:


      protected function adgGrid_itemClick( event:Event ):void {
           if ( adg_mappedTagsList.selectedItems.length == 1 ) {
                if ( adg_mappedTagsList.selectedItem != null ) {
                     // User selected another row.
                     if ( previousCallerIntentId != adg_mappedTagsList.selectedItem.id ) {
                          clickCount = 0;
                          previousCallerIntentId = adg_mappedTagsList.selectedItem.id;
           // Edit is allowed only when count is greater than 1.
           // Need to update the details display when both a single row is clicked or when multiple rows are selected.


      So when the user single-clicks on a row, the row  is just selected, and corresponding data in other panels is fetched.  When the user single-clicks again on a cell in this selected row, then  that cell goes into Edit mode.

      I've noticed the following behaviour:
      1. I single-click on a row, the row is selected, no cell is in Edit mode yet.
      2. Which cell I clicked on (not counting the Labels cell) determines the  number of Tabs that is required to get me to the first cell in the next  row.
      3. For example, if I clicked in the first column (Caller Intent), it  would take 4 Tabs to get to the first cell in the next row (remember  that the Labels cell is uneditable).
      4. If I clicked in the last/fifth column (Confirmation Promptlet), it  would take only 1 Tab to get to the first cell in the next row.
      This leads me to believe that the "selected" column is known even though the cell is not in Edit mode.

      I have a requirement to put the cell that was clicked on in a selected row into Edit mode if the user presses F2.

      The selectedIndex of the grid indicates the selected row. However, I  can't seem to find an equivalent for the selected column. I see that  there is a selectedCells array. I tried to figure out how this is used,  but it seems that columnIndex always remains -1 no matter which column I  click in. Only the rowIndex changes.

      Thanks for your guidance,