I believe the “change” event
is going to fire when you update the selections using the keyboard. childIndexChanged
is meaningless for DataGrid.
Matt
From: greenfishinwater
[mailto:[EMAIL PROTECTED]
Sent: Thursday, March 03, 2005
7:50 AM
To: [email protected]
Subject: [flexcoders] DataGrid
event childIndexChanged not firing
I have reduced my problem down to the event
childIndexChanged not
firing, or not working as expected. I have example
code below which
illustrates the problem.
I click on a cell, the event cellPress is fired
and displays data in
the xyz label. What I want also to happen isif I
use the up or down
arrow keys to move to a different row in thegrid,
then the same logic
as the cellPress event is required. I implemented
this via the
childIndexChanged event, but it does not fire. I
also tried the events
focusIn and cellFocusIn but they dont work.
The selectedIndex value has changed, which can be
seen in label abc.
I know in the example below that I can use data
binding to get the
results, but in my own Flex app, I need an AS
function do do a lot
more besides displaying a bit of data.
Example code:
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:DataGrid id="musicGrid"
cellPress="xyz.text=musicGrid.selectedItem.Album"
childIndexChanged="xyz.text=musicGrid.selectedItem.Album">
<mx:dataProvider>
<mx:Array>
<mx:Object Artist="Pavement"
Price="11.99" Album="Slanted and
Enchanted" />
<mx:Object Artist="Pavement"
Album="Brighten the Corners" Price="11.99" />
<mx:Object Artist="Test"
Album="Flex" Price="0.99" />
</mx:Array>
</mx:dataProvider>
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="Album"
/>
<mx:DataGridColumn columnName="Price"
/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
<mx:Label text="Album"
id="xyz" />
<mx:Label
text="{musicGrid.selectedIndex}" id="abc" />
</mx:Application>
Andrew
|