arraycollection から拡張されたオブジェクトがあります。このオブジェクトは、arraycollections ソース オブジェクトにアクセスして操作する必要があります。これが発生すると、データのローカルの並べ替え/フィルター コピーがソース データと同期しなくなります。正しく並べ替えるには、並べ替え/フィルターを再適用する必要があります。
通常これを行うには、arraycollection で refresh() を呼び出しますが、これは更新イベントもブロードキャストします。私が望むのは、イベントをディスパッチせずに並べ替え/フィルターを更新することです。
ArrayCollection クラスを調べると、ListCollectionView から拡張されていることがわかります。リフレッシュ機能
public function refresh():Boolean
{
return internalRefresh(true);
}
ListCollectionView にあり、この関数を呼び出します
private function internalRefresh(dispatch:Boolean):Boolean
{
if (sort || filterFunction != null)
{
try
{
populateLocalIndex();
}
catch(pending:ItemPendingError)
{
pending.addResponder(new ItemResponder(
function(data:Object, token:Object = null):void
{
internalRefresh(dispatch);
},
function(info:Object, token:Object = null):void
{
//no-op
}));
return false;
}
if (filterFunction != null)
{
var tmp:Array = [];
var len:int = localIndex.length;
for (var i:int = 0; i < len; i++)
{
var item:Object = localIndex[i];
if (filterFunction(item))
{
tmp.push(item);
}
}
localIndex = tmp;
}
if (sort)
{
sort.sort(localIndex);
dispatch = true;
}
}
else if (localIndex)
{
localIndex = null;
}
revision++;
pendingUpdates = null;
if (dispatch)
{
var refreshEvent:CollectionEvent =
new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
refreshEvent.kind = CollectionEventKind.REFRESH;
dispatchEvent(refreshEvent);
}
return true;
}
厄介なことに、その関数はプライベートであるため、ListCollectionView を拡張するクラスでは使用できません。また、 internalRefresh 関数にあるものの多くも非公開です。
ArrayCollection を拡張するクラスから internalRefresh を呼び出す方法を知っている人はいますか? または、更新が呼び出されたときに更新イベントのディスパッチを停止する方法はありますか?