When you have two of the same records in your data providor (i.e. the same object twice in an array) then the datagrid only allow you to select one of them, see the example below - you can only select the last "Moo".
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
private var sourceData:Array = [];
private function init():void {
var a:Object = {Title:"Moo"};
var b:Object = {Title:"Goo"};
var c:Object = {Title:"Foo"};
sourceData.push(a,b,c,a); //<-- "a" inserted twice
dg.dataProvider = sourceData;
}
]]>
</mx:Script>
<mx:DataGrid id="dg"/>
</mx:WindowedApplication>
I'm pretty sure this is becuase of the selectedItem property - i.e. if you have two of the same objects in your dataprovidor and you select on its only going to select the first one it finds.
Not sure the best way to resolve this. I could make sure each object is unique by cloning them all. But then I will have to make sure that updates on the 'a' object are propagated to all the "clones" of "a".
Anyone have any suggestions or ideas?