Go Back   CodingForums.com > :: Client side development > Flash & ActionScript > Adobe Flex

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-22-2011, 05:49 PM   PM User | #1
bon_t
New Coder

 
Join Date: Jul 2010
Posts: 32
Thanks: 1
Thanked 0 Times in 0 Posts
bon_t is an unknown quantity at this point
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
Click image for larger version

Name:	app_config_main_grid.JPG
Views:	104
Size:	21.0 KB
ID:	9970  
bon_t is offline   Reply With Quote
Reply

Bookmarks

Tags
actionscript3, advanceddatagrid, flex4, selectedcolumn

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:46 AM.


Advertisement
Log in to turn off these ads.