I am running into problems using list.setStore() to assign a new store to a grouped list.

var list = this.down('#docsList');

var listStore = doclistStore();

listStore.setGroupField('groupcaption');

list.setStore(listStore);


I can run the code above successfully and repeatedly as long as I only point it to the same store.

If I attempt to use a different store (with a list of documents belonging to another object), then it will blow up with the error:
Uncaught TypeError: Cannot read property 'getHeader' of undefined

If I disable grouping and comment out the line setting the group field then the code works as intended but I lose grouping.



// Disable Grouping

list.setGrouped(false);

//listStore.setGroupField('groupcaption');


Anthony