PDA

View Full Version : Ext.data.Store require Ext.util.Grouper (and not use)



Psychokrameur
29 Nov 2013, 7:08 AM
ExtJs Version 4.2.2.

It seems to me that there is a little error in the requires/uses declaration of Ext.data.Store.

Ext.util.Grouper might be un requires section instead of uses section as it's used in the methode
decodeGroupers which is directly call in the constructor.



Ext.define('Ext.data.Store', {
extend: 'Ext.data.AbstractStore',

alias: 'store.store',

// Required classes must be loaded before the definition callback runs
// The class definition callback creates a dummy Store which requires that
// all the classes below have been loaded.
requires: [
'Ext.data.StoreManager',
'Ext.data.Model',
'Ext.data.proxy.Ajax',
'Ext.data.proxy.Memory',
'Ext.data.reader.Json',
'Ext.data.writer.Json',
'Ext.data.PageMap',
'Ext.data.Group'
],

uses: [
'Ext.ModelManager',
'Ext.util.Grouper'
],


Require Ext.data.Store at the begining of my application loading cause an error "Grouper is not defined" on the following code:

if (!(config instanceof Grouper)) {

If I do not add a require to Ext.util.Grouper prior.

Regards,
Psycho

Gary Schlosberg
29 Nov 2013, 4:53 PM
Thanks for the report. Can you please post a test case which reproduces the issue? You can use our Fiddle (https://fiddle.sencha.com/#home) if you like.

Psychokrameur
2 Dec 2013, 4:20 AM
Hi,

I don't think it's possible to do this with Fiddle because all ExtJs Framework is loaded before the application start if I'm not wrong?

The problem appear when I update my code from none Sencha Cmd managed to Sencha Cmd managed app and it seems that the order of requires has a strong influence.

Here is the little bit of code that I case the issue.



Ext.require([ 'Ext.data.Request', 'Ext.direct.*' ], function() {
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
});

Ext.define('MyApp.Application', {
name: 'MyApp',

extend: 'Ext.app.Application',

requires: [
// 'Ext.util.Grouper',
'Common.util.*'
],

views: [
],

controllers: [
// list of my controller
],

stores: [
]

});

Common is a code package containing some Util fonction (and model, stuff like that) mostly in Singleton class. And at list one use Ext.data.Store in his initialisation.

If i remove the Ext.util.Grouper from requires (as it is here), error appear :

TypeError: invalid 'instanceof' operand Grouper

if (!(config instanceof Grouper)) {

Firebug: Store....9078708 (ligne 637)


I don't know how to reproduce this bug outside my environment.

toni07
19 Dec 2013, 6:16 AM
@Psychokrameur: Same problem here. Thanks for pointing this out. Putting 'Ext.util.Grouper' in the requires section seems to fix the problem. Thank you!