jeudi 18 décembre 2014

Store groupField

Hi !

I'm migrating my project from ExtJs 5.0.0.9 to 5.0.1 and I'm encountering some troubles.

I hope you can help me...


The subject :

my store param groupField now causes an error on ext-all.js :



Code:



Uncaught TypeError: Cannot read property 'apply' of undefined
Ext.cmd.derive.onViewRefresh
(anonymous function)
fire
doFireEvent
a.doFireEvent
fireEventArgs
fireEvent
Ext.cmd.derive.onBoxReady
Ext.cmd.derive.afterFirstLayout
Ext.cmd.derive.afterComponentLayout
a.afterComponentLayout
Ext.cmd.derive.notifyOwner
Ext.cmd.derive.callLayout
Ext.cmd.derive.flushLayouts
Ext.cmd.derive.runComplete
m
Ext.Base.h.addMembers.callParent
Ext.override.runComplete
Ext.cmd.derive.run
Ext.cmd.derive.statics.flushLayouts
Ext.cmd.derive.statics.updateLayout
Ext.cmd.derive.updateLayout
Ext.cmd.derive.onContentChange
Ext.cmd.derive.doCollapseExpand
Ext.cmd.derive.expand
Ext.cmd.derive.toggleCollapse
fire ext-all.js:22doFireEvent
a.doFireEvent
fireEventArgs
fireEvent
Ext.cmd.derive.privates.fireClickEvent
Ext.cmd.derive.privates.onClick
Ext.cmd.derive.doFire
Ext.cmd.derive.fire
Ext.cmd.derive.doDispatchEvent
Ext.cmd.derive.dispatch
Ext.cmd.derive.dispatch
Ext.cmd.derive.doPublish
Ext.cmd.derive.publish
Ext.cmd.derive.doDelegatedEvent
Ext.cmd.derive.onDelegatedEvent
(anonymous function) ext-all.js:22


Here is a simple fiddle (note that the fiddle does not cause any error ) : http://ift.tt/1wlfJv0

I've a grid inside an accordion.

By my side, the error occurs when I clic on the accordion to expand the grid.

If I do not mention the store param groupField, then no error.

Here are some parts of my real code:



Code:



Ext.define('Secteur', {
extend: 'Ext.data.Model',
fields: [
{name: 'REGION', type: 'string'},
{name: 'SECTEUR', type: 'string'},
...
]
});

createSecteurs: function(){
var Secteurs = Ext.create('Ext.grid.Panel', {
title: 'Secteurs',
multiSelect: true,
store: Ext.create('Ext.data.Store', {
autoLoad: true,
storeId:'SEC',
model: 'Secteur',
sorters: ['REGION', 'SECTEUR'],
groupField: 'REGION',
proxy: {
type: 'ajax',
limitParam: 100,
pageParam: undefined,
pageSize: 100,
api: {
read: 'store/store_secteurs.php',
update: 'store/store_UPDATE_secteur.php'
},
reader: {
type: 'json',
root: 'data'
},
writer: {
type: 'json',
writeAllFields: true,
root: 'data'
}
}
}),
viewConfig: {
stripeRows: true,
enableTextSelection: true
},
columns: [SOME COLUMNS],
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 2,
listeners: {
'beforeedit': function(editor,context) {
if(DataSession.admin==false)
return false;
return true;
}
}
})
],
features: [{ftype:'grouping',
enableGroupingMenu: true,
enableNoGroups :true,
groupHeaderTpl: Ext.create('Ext.XTemplate',
'',
'<div>{name:this.formatName}</div>',
{
formatName: function(name) {
return Ext.String.trim(name);
}
}
)
}],
listeners: {
expand: function() {
Ext.getCmp('fake').expanded=false;
if(this.getStore().getCount()==0) this.getStore().load();
}
},
id: 'Secteurs'
});
return Secteurs;

...

createAccordion: function(){
var Accordion = Ext.create('Ext.panel.Panel', {
id: 'Accordion',
border:false,
layout: {
type: 'accordion',
animate: true,
activeOnTop: false
},
items: [
// fake hidden panel
{ id: 'fake',
xtype: 'panel',
hidden: true,
expanded: true,
collapsed: false },
this.createSecteurs(),
this.createRegions()
],
});
return Accordion;
}

I'm really hopping you can help me to solve this.

Charlotte.






Store groupField

Aucun commentaire:

Enregistrer un commentaire