Sencha touch Sencha触摸列表清洁数据

Sencha touch Sencha触摸列表清洁数据,sencha-touch,sencha-touch-2,Sencha Touch,Sencha Touch 2,我有以下代码 var list = this.getNavigation(); if (list.itemsCount > 0) { list.removeAll(true, true); } list.setData(filtered); List=xtype:List。 所以下一个想法是我有菜单,有时我需要重建它。正如您所看到的,我没有使用store,因为我需要过滤数组并设置它。 我给removeAll打电话时出错了 Uncaught TypeError: Cannot cal

我有以下代码

var list = this.getNavigation();
if (list.itemsCount > 0) {
   list.removeAll(true, true);
}
list.setData(filtered);
List=xtype:List。 所以下一个想法是我有菜单,有时我需要重建它。正如您所看到的,我没有使用store,因为我需要过滤数组并设置它。 我给removeAll打电话时出错了

Uncaught TypeError: Cannot call method 'getScroller' of undefined 

而且我找不到清理它的方法…

我重新编写了我的菜单以使用store,而不是setData on list,我正在设置store上的数据,它按预期工作

另一个选项是调用removeAll,destroy设置为
false
,如下所示:

var list = this.getNavigation();
if (list.itemsCount > 0) { list.removeAll(false); }
list.setData(filtered);

通过某种自动清理,列表DOM项无论如何都会被删除。

列表后面有存储吗?没有,我只是用setdataset设置了数组,为什么不过滤存储中的数据呢?我原以为既然列表有方法集,那就很容易了,但现在我看到我应该用store for itt谢谢大家,是的,使用store它就像一个符咒:)