This one has nailed me several times this week, so …
The Flash MX 2004 DataGrid component allows for the browsing and editing of data, including data retrieved from ColdFusion (via Flash Remoting or SOAP). Data grids are typically populated by datasets (which in turn are populated using connectors or ActionScript code). The relationship between datasets and data grids is rather tenuous, to the point that scrolling or changing position in a data grid does not automatically change the position in the dataset. This is rather counter-intuitive, and means is that if you attempt to programmatically obtain information about the currently highlighted record, you may get the wrong row. Similarly, if you “delete the current row in a grid” you may delete the wrong row from the dataset. The solution? You must explicitly instruct the data grid and dataset to stay in synch by binding selectedIndex property of each of them to each other, this way as you move within the grid the internal dataset pointer moves too.
Leave a Reply