Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Jul 2010
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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. Pls refer to attachment.

    I associated the following method to the itemClick event:

    Code:
    protected function adgGrid_itemClick( event:Event ):void {
    	adg_mappedTagsList.selectedCells;
    	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.
    	clickCount++;
    	// Need to update the details display when both a single row is clicked or when multiple rows are selected.
    	adg_mappedTagsList_itemClickHandler();
    }
    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,
    Bonnie
    Attached Thumbnails Attached Thumbnails How to get value of "selected" column in AdvancedDataGrid-app_config_main_grid.jpg  


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •