Flex:列表在滚动之前显示错误
我有一个列表,在您滚动之前不会显示任何项目,然后项目就会显示出来。有谁知道如何解决这个问题?我尝试调用 list.invalidateDisplayList(); 和 list.invalidateList(); 但没有运气。
有什么想法吗?
谢谢。
编辑:这是一些代码:
<mx:Script>
<![CDATA[
[Bindable]
private var _xmlList:XMLList = new XMLList();
override public function set data(value:Object):void
{
this.setStyle('borderColor','#cc6666');
var xmllist:XMLList = XML(value).children();
_xmlList = xmllist;
}
]]>
</mx:Script>
<mx:List id="list" width="100%" height="100%" labelField="@user" dataProvider="{_xmlList}" itemClick="onItemClick(event)"/>
我发现如果添加 creationComplete="{list.dataProvider = _xmlList }" 它可以解决问题。
I have a List, that is not showing any items until you scroll, then the items show up. Does anyone know how to fix this? I tried calling list.invalidateDisplayList(); and list.invalidateList(); But with no luck.
Any ideas?
Thanks.
EDIT: Here is some code:
<mx:Script>
<![CDATA[
[Bindable]
private var _xmlList:XMLList = new XMLList();
override public function set data(value:Object):void
{
this.setStyle('borderColor','#cc6666');
var xmllist:XMLList = XML(value).children();
_xmlList = xmllist;
}
]]>
</mx:Script>
<mx:List id="list" width="100%" height="100%" labelField="@user" dataProvider="{_xmlList}" itemClick="onItemClick(event)"/>
I found that if I add creationComplete="{list.dataProvider = _xmlList }" It solves the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试调用:
这会导致内联同步控件刷新。
invalidateDisplayList()
调用只是告诉控件下次绘制时,它应该重新计算显示列表。它不会立即强制刷新。You might try calling:
This causes an inline, synchronous control refresh. The
invalidateDisplayList()
call just tells the control that the next time it's drawn, it should re-compute the display list. It doesn't force the refresh immediately.还尝试添加
Also trying adding