_PASCAL_
20 Sep 2012, 5:46 AM
Hi,
I have written some code to display some accounts in an gridview.
There I want to group the accounts by its "category" ...
In Firefox all works great. But in IE only the first entry of each group is
listed in the gridview. Why?
hier's my code:
model:
Ext.define('tvd.model.AccountMod', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [{
name: 'id',
type: 'int'
},{
name: 'username',
type: 'string'
},{
name: 'surename',
type: 'string'
},{
name: 'lastname',
type: 'string'
},{
name: 'phone',
type: 'string'
},{
name: 'mobile',
type: 'string'
},{
name: 'email',
type: 'string'
},{
name: 'member',
type: 'string'
},{
name: 'category',
type: 'string'
},{
name: 'street',
type: 'string'
},{
name: 'city',
type: 'string'
},{
name: 'additional',
type: 'string'
},{
name: 'isAdmin',
type: 'boolean'
},{
name: 'totalWork',
type: 'int'
},{
name: 'lastAction',
type: 'String'
},{
name: 'lastlastAction',
type: 'String'
}]
});
store:
Ext.define('tvd.store.AccountStore', {
extend: 'Ext.data.Store',
requires: 'tvd.model.AccountMod',
model: 'tvd.model.AccountMod',
storeId: 'accountstore',
groupField: 'category',
proxy: {
type: 'ajax',
url: 'back/account?action=getAccounts',
reader: {
type: 'json',
root: 'results'
}
},
listeners: {
load: function(store, records, successful, eOpts ){
if(store.proxy.reader)
if(store.proxy.reader.jsonData.timeout === true)
tvd.tvdGlobals.showTimeOut();
}
}
});
gridview:
Ext.define('tvd.view.AccountView', {
extend: 'Ext.panel.Panel',
alias: 'widget.accountview',
layout: 'fit',
stores: ['AccountStore'],
initComponent: function() {
var me = this;
var store = this.store;
store.sort('lastname', 'ASC');
var groupingFeature = Ext.create('Ext.grid.feature.Grouping', {
groupHeaderTpl: '{name} - Anzahl: {rows.length}',
hideGroupedHeader: true,
startCollapsed: false,
id: 'accountGrouping'
});
Ext.applyIf(me, {
dockedItems: [{
xtype: 'toolbar',
height:32,
style:'padding:4px;',
dock: 'bottom',
items: [{
text: 'hinzufügen',
iconCls: 'addAccount',
id: 'add_account_button'
},{
text: 'Email/Zwischenablage',
iconCls: 'emailCopy',
tooltip: 'kopiert die selektieren Email-Adressen in die Zwischenablage',
id: 'get_email_button'
}]
}],
items: [{
xtype: 'gridpanel',
id: 'account_grid',
hideCollapseTool: true,
border: false,
invalidateScrollerOnRefresh: false,
autoScroll: true,
store: store,
multiSelect: true,
componentCls: 'x-mygrid',
features: [groupingFeature],
columns: [{
xtype: 'gridcolumn',
hideable: false,
header: 'Nachname',
dataIndex: 'lastname',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Vorname',
dataIndex: 'surename',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'E-Mail',
dataIndex: 'email',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 4
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Telefon',
dataIndex: 'phone',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Handy',
dataIndex: 'mobile',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Kategorie',
dataIndex: 'category',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
}],
listeners: {
groupcontextmenu: function( view, node, group, e, eOpts ){
e.preventDefault();
new Ext.menu.Menu({
items: [{
text: 'Gruppe auswählen',
iconCls: 'emailCopy',
listeners: {
click: function(button){
view.panel.fireEvent('groupSelect',view.panel, group, e);
}
}
}]
}).showAt(e.xy);
},
itemcontextmenu: function(view, record, item, index, e, eOpts ) {
e.preventDefault();
me.deleteRecord = record;
if(record.get('isAdmin') === true){
new Ext.menu.Menu({
items: [{
text: 'bearbeiten',
iconCls: 'editAccount',
listeners: {
click: function(button){
view.panel.fireEvent('editAccount',view.panel, record);
}
}
},'-',{
text: 'löschen',
iconCls: 'deleteAccount',
listeners: {
click: function(button){
view.panel.fireEvent('deleteAccount',view.panel, record);
}
}
},{
text: 'Adminrechte entfernen',
iconCls: 'Account',
listeners: {
click: function(button){
view.panel.fireEvent('removeAdminAccount',view.panel, record);
}
}
}]
}).showAt(e.xy);
}else{
new Ext.menu.Menu({
items: [{
text: 'bearbeiten',
iconCls: 'editAccount',
listeners: {
click: function(button){
view.panel.fireEvent('editAccount',view.panel, record);
}
}
},'-',{
text: 'löschen',
iconCls: 'deleteAccount',
listeners: {
click: function(button){
view.panel.fireEvent('deleteAccount',view.panel, record);
}
}
},{
text: 'Adminrechte hinzufügen',
iconCls: 'Account',
listeners: {
click: function(button){
view.panel.fireEvent('setAdminAccount',view.panel, record);
}
}
}]
}).showAt(e.xy);
}
}
}
}]
});
this.callParent();
}
});
I have written some code to display some accounts in an gridview.
There I want to group the accounts by its "category" ...
In Firefox all works great. But in IE only the first entry of each group is
listed in the gridview. Why?
hier's my code:
model:
Ext.define('tvd.model.AccountMod', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [{
name: 'id',
type: 'int'
},{
name: 'username',
type: 'string'
},{
name: 'surename',
type: 'string'
},{
name: 'lastname',
type: 'string'
},{
name: 'phone',
type: 'string'
},{
name: 'mobile',
type: 'string'
},{
name: 'email',
type: 'string'
},{
name: 'member',
type: 'string'
},{
name: 'category',
type: 'string'
},{
name: 'street',
type: 'string'
},{
name: 'city',
type: 'string'
},{
name: 'additional',
type: 'string'
},{
name: 'isAdmin',
type: 'boolean'
},{
name: 'totalWork',
type: 'int'
},{
name: 'lastAction',
type: 'String'
},{
name: 'lastlastAction',
type: 'String'
}]
});
store:
Ext.define('tvd.store.AccountStore', {
extend: 'Ext.data.Store',
requires: 'tvd.model.AccountMod',
model: 'tvd.model.AccountMod',
storeId: 'accountstore',
groupField: 'category',
proxy: {
type: 'ajax',
url: 'back/account?action=getAccounts',
reader: {
type: 'json',
root: 'results'
}
},
listeners: {
load: function(store, records, successful, eOpts ){
if(store.proxy.reader)
if(store.proxy.reader.jsonData.timeout === true)
tvd.tvdGlobals.showTimeOut();
}
}
});
gridview:
Ext.define('tvd.view.AccountView', {
extend: 'Ext.panel.Panel',
alias: 'widget.accountview',
layout: 'fit',
stores: ['AccountStore'],
initComponent: function() {
var me = this;
var store = this.store;
store.sort('lastname', 'ASC');
var groupingFeature = Ext.create('Ext.grid.feature.Grouping', {
groupHeaderTpl: '{name} - Anzahl: {rows.length}',
hideGroupedHeader: true,
startCollapsed: false,
id: 'accountGrouping'
});
Ext.applyIf(me, {
dockedItems: [{
xtype: 'toolbar',
height:32,
style:'padding:4px;',
dock: 'bottom',
items: [{
text: 'hinzufügen',
iconCls: 'addAccount',
id: 'add_account_button'
},{
text: 'Email/Zwischenablage',
iconCls: 'emailCopy',
tooltip: 'kopiert die selektieren Email-Adressen in die Zwischenablage',
id: 'get_email_button'
}]
}],
items: [{
xtype: 'gridpanel',
id: 'account_grid',
hideCollapseTool: true,
border: false,
invalidateScrollerOnRefresh: false,
autoScroll: true,
store: store,
multiSelect: true,
componentCls: 'x-mygrid',
features: [groupingFeature],
columns: [{
xtype: 'gridcolumn',
hideable: false,
header: 'Nachname',
dataIndex: 'lastname',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Vorname',
dataIndex: 'surename',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'E-Mail',
dataIndex: 'email',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 4
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Telefon',
dataIndex: 'phone',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Handy',
dataIndex: 'mobile',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
},{
xtype: 'gridcolumn',
hideable: false,
header: 'Kategorie',
dataIndex: 'category',
menuDisabled: true,
sortable: false,
fixed: true,
resizeable: false,
flex: 2
}],
listeners: {
groupcontextmenu: function( view, node, group, e, eOpts ){
e.preventDefault();
new Ext.menu.Menu({
items: [{
text: 'Gruppe auswählen',
iconCls: 'emailCopy',
listeners: {
click: function(button){
view.panel.fireEvent('groupSelect',view.panel, group, e);
}
}
}]
}).showAt(e.xy);
},
itemcontextmenu: function(view, record, item, index, e, eOpts ) {
e.preventDefault();
me.deleteRecord = record;
if(record.get('isAdmin') === true){
new Ext.menu.Menu({
items: [{
text: 'bearbeiten',
iconCls: 'editAccount',
listeners: {
click: function(button){
view.panel.fireEvent('editAccount',view.panel, record);
}
}
},'-',{
text: 'löschen',
iconCls: 'deleteAccount',
listeners: {
click: function(button){
view.panel.fireEvent('deleteAccount',view.panel, record);
}
}
},{
text: 'Adminrechte entfernen',
iconCls: 'Account',
listeners: {
click: function(button){
view.panel.fireEvent('removeAdminAccount',view.panel, record);
}
}
}]
}).showAt(e.xy);
}else{
new Ext.menu.Menu({
items: [{
text: 'bearbeiten',
iconCls: 'editAccount',
listeners: {
click: function(button){
view.panel.fireEvent('editAccount',view.panel, record);
}
}
},'-',{
text: 'löschen',
iconCls: 'deleteAccount',
listeners: {
click: function(button){
view.panel.fireEvent('deleteAccount',view.panel, record);
}
}
},{
text: 'Adminrechte hinzufügen',
iconCls: 'Account',
listeners: {
click: function(button){
view.panel.fireEvent('setAdminAccount',view.panel, record);
}
}
}]
}).showAt(e.xy);
}
}
}
}]
});
this.callParent();
}
});