1
votes

I have following code.

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

List = xtype: list. So idea is next i have menu and some times i need to rebuild it. as you see i am not using store because i need to filter array and set it. When i call removeAll i got error

Uncaught TypeError: Cannot call method 'getScroller' of undefined 

And i cant find method to cleanup it...

2
Do you have a store behind the list?Darin Kolev
No i just set array using setDataVova Bilyachat
Why don't you filter data in a store?kio21
I thought since list has method set it would be easy but now i see that i should use store for itVova Bilyachat
Thanks everyone, yes using store it works like a charm :)Vova Bilyachat

2 Answers

0
votes

I rewrote my menu to use store and instead of setData on list i am setting data on store and it works as expected

0
votes

Another option would be calling removeAll with destroy set to false like so:

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

The list DOM items get deleted anyways by some sort of auto-cleanup.