. DataGrid String uniqueIdField.
vaule uniqueIdField .
dataProvider, :
, . FIXED * , hightlights, ( , , ). *
.
set dataProvider (: Object): void { var vScroll: int = 0; // , // if (uniqueIdField.length > 0 && selectedItem!= null) { uniqueIdData = this.selectedItem [uniqueIdField]; vScroll = this.verticalScrollPosition; }
super.dataProvider = ;
if(uniqueIdField.length > 0
&& uniqueIdData != null
&& selectedItems.length <= 1)
{
var currentObj: Object; var found: Boolean = false;
if(dataProvider is ArrayCollection)
{
for(var i:int=0; i < dataProvider.length; i++)
{
currentObj = dataProvider.getItemAt(i);
if(currentObj[uniqueIdField] == uniqueIdData)
{
this.selectedItem = currentObj;
found = true;
vScroll = this.selectedIndex;
break;
}
}
if(!found)
{
this.selectedItem = null;
uniqueIdData = null;
}
}
//, , null this.verticalScrollPosition = vScroll; dispatchEvent ( ListEvent (ListEvent.CHANGE));
}