从ListView中删除最后一项会导致应用崩溃 [英] Removing last item from ListView crashes app

查看:74
本文介绍了从ListView中删除最后一项会导致应用崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我试图通过操纵数据源并使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆