从ListView中删除最后一项会导致应用崩溃 [英] Removing last item from ListView crashes app
问题描述
大家好,
我试图通过操纵数据源并使用listview.itemDataSource.remove(item.key)从列表视图中删除项目
这适用于所有项目,直到我点击最后一个项目,即应用程序崩溃时:
在ms-appx://microsoft.winjs.1.0/js/ui.js的第9行第1070行的JavaScript库代码将捕获异常
0x800a138f - JavaScript运行时错误:无法获取未定义或空引用的属性'uniqueID'
我做错了什么/遗忘了吗?
谢谢,
截尾
每次从列表视图中删除项目时是否使用listview.forcelayout。
我认为它正在尝试至从UI中删除列表视图中不存在的项目,这似乎是导致此错误的原因。
http://msdn.microsoft.com/en-us/library/windows/apps/hh758352.aspx
Hi all,
I am trying to remove items from a listview by manipulating the datasource and using listview.itemDataSource.remove(item.key)
This works for all items, until I hit the last one, which is when the app crashes with this:
Exception is about to be caught by JavaScript library code at line 10705, column 9 in ms-appx://microsoft.winjs.1.0/js/ui.js
0x800a138f - JavaScript runtime error: Unable to get property 'uniqueID' of undefined or null reference
Am I doing something wrong/ forgetting something here?
Thanks,
Censored
Are you using listview.forcelayout each time you remove an item from your listview.
I assume it is trying to delete an item from UI which is not existing in your listview and that seems to be the cause of this error.
http://msdn.microsoft.com/en-us/library/windows/apps/hh758352.aspx
这篇关于从ListView中删除最后一项会导致应用崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!