我有以下代码
_data.sort = null;
agentRow=new Object();
agentRow.AgentID=agentId;
_data.addItem(agentRow);
这会导致以下错误:
TypeError: Error #1006: value is not a function.
at mx.collections::ListCollectionView/getFilteredItemIndex()
at mx.collections::ListCollectionView/addItemsToView()
at mx.collections::ListCollectionView/listChangeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.collections::ArrayList/internalDispatchEvent()
at mx.collections::ArrayList/addItemAt()
at mx.collections::ListCollectionView/addItemAt()
at mx.collections::ListCollectionView/addItem()
at com.informiam.frontlineAdvisor.dashboard.model::TeamMetricAggregator/merge()
at com.informiam.frontlineAdvisor.dashboard.controller::AdvisorController/mergeTeamViewData()
at com.informiam.frontlineAdvisor.dashboard.view.components::TeamView/mergeMetricsResult()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at NetConnectionMessageResponder/resultHandler()
at mx.messaging::MessageResponder/result()
_data是一个
ArrayCollection
如果删除行_data.sort = null;
,则错误消失,但我需要此行。
答案 0 :(得分:0)
问题似乎是合乎逻辑的null
不是sort属性的可接受值。虽然我没有大多数flex组件(包括这个组件)的经验,但我执行以下操作之一可以纠正您的问题:
一个。不要为sort属性赋值(我假设这相当于没有排序)
OR
湾将new Sort()
代替null
分配给您的_data.sort
媒体资源。
答案 1 :(得分:-1)
_data.sort = null;
_data.refresh();
agentRow=new Object();
agentRow.AgentID=agentId;
_data.addItem(agentRow);