I am trying to dynamically create grid.Panels and add them to my View, since I don't know have many "Views" I need before I load the data. For example, I have a number of people in different groups, once I load the data, I want to create a grid.Panel for each group and put the correct people in it.
The problem is that my application hangs when I do it (probably because the Store is being loaded recursively)
How do I add a grid.Panel to my View with data from a Store without it hanging?
My Controller:
Ext.define('NG.controller.Navigation', {
extend: 'Ext.app.Controller',
refs: [{
selector: 'group',
ref: 'groupPanel'}
],
stores: ['Groups'],
init: function() {
this.control({
'navigation': {
itemdblclick: this.onNavigationSelection
}
});
},
onNavigationSelection: function(view, record, item, index, eventobj, obj) {
var groupsstore = this.getGroupsStore();
var group1 = Ext.create('Ext.grid.Panel', {
store: groupsstore,
title: 'Group 1',
columns: [
{header: 'Name', dataIndex: 'name'},
{header: 'Mail:', dataIndex: 'mail'}
]
});
groupsstore.load();
this.getGroupPanel().add(group1);
}
});
My View:
Ext.define('NG.view.Group', {
extend: 'Ext.panel.Panel',
alias: 'widget.group',
store: 'Groups',
initComponent: function() {
this.callParent();
}
});
And my Store (not sure if it is needed):
Ext.define('NG.store.Groups', {
extend: 'Ext.data.Store',
requires: 'NG.model.Person',
model: 'NG.model.Person'
});
Best regards and thank you in advance!
Andreas