PDA

View Full Version : Store load handler not getting fired



stalek
18 Jul 2014, 5:14 AM
Hello,
I have created two identical definitions for models and stores used by two grid panels (they differs in names only).
When I call "load" method on first one everything is ok. When I call load on second one my callback is never fired (I test stores without grid's usage).
I spent two day already investigating the issue (digging really deep on ext.js level).
I see the response is sent to the browser, then ajax and direct proxy objects react for such response (I see proper data on different events), but store is never notified in case of second store definition.
These two stores are identical - they differ in names only (and in column names in models of course).
When I attach second store definition to grid panel it fires load and then remains in "blur" state indefinitely (no any exceptions and so on).

Does anybody know such issue? Maybe it has been identified and resolved already?
I use Ext.JS in version 4.1.1 (Build date: 2012-10-25 15:13:53 )

Thanks in advance
Alek

skirtle
18 Jul 2014, 6:09 AM
You'll have to post some code to get any help with this.

stalek
18 Jul 2014, 7:12 AM
Ok.
Below is working definition for model:



Ext.define('App.model.InvalidDocument', {
extend: 'Ext.data.Model',
//idProperty: 'InvalidDocumentID',
fields: [
'InvalidDocumentID',
'DocType',
'RISExamCode',
'DeviceCode',
'RISProcedureCode',
'PersonalId',
'Firstname',
'Lastname',
'City',
{ name: 'ExamDate', type: 'date' },
'ErrorMessage',
'ErrorInfo',
'RegisteredBy',
{ name: 'RegisteredAt', type: 'date' }
]
});


This is working definition for store:



Ext.require([
'Ext.direct.Manager',
'App.model.DictDefault',
'App.ajax.SystemMessages'
]);


// Activate Direct Provider
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);


// Store definition
Ext.define('App.store.InvalidDocument', {
extend: 'Ext.data.Store',
requires: 'App.model.InvalidDocument',
model: 'App.model.InvalidDocument',
pageSize: 50,
remoteSort: true,
remoteFilter: true,
sorters: [{
property: 'RegisteredAt',
direction: 'DESC'
}],


constructor: function (config) {
var me = this;


var proxy = Ext.create('Ext.data.proxy.Direct', {
directFn: InvalidDocumentService.Read,
paramOrder: 'start|limit|sort|filter|query|docType',
paramsAsHash: false,
extraParams: {
symbol: ''
},
reader: {
type: 'json',
root: 'Result',
totalProperty: 'TotalCount',
idProperty: 'InvalidDocumentID',
messageProperty: 'message',
listeners: {
exception: function () {
var ex = 1;
}
}
}
});


// Clone the config so we don't modify the original config object
config = Ext.apply({ proxy: proxy }, config);


//me.callParent( arguments ); // calls My.app.Panel's constructor
me.callParent([config]);
}
});


This is the definition of a model for the store that doesn't work:



Ext.define('App.model.NFZDocument', {
extend: 'Ext.data.Model',
//idProperty: 'BadanieID',
fields: [
'BadanieID',
'DeviceCode'
]
});


This is definition of store that doesn't work:



Ext.require([
'Ext.direct.Manager',
'App.model.DictDefault',
'App.ajax.SystemMessages'
]);


// Activate Direct Provider
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);


// Store definition
Ext.define('App.store.NFZDocument', {
extend: 'Ext.data.Store',
requires: 'App.model.NFZDocument',
model: 'App.model.NFZDocument',
pageSize: 50,
remoteSort: true,
remoteFilter: true,
sorters: [{
property: 'DeviceCode',
direction: 'DESC'
}],


constructor: function (config) {
var me = this;


var proxy = Ext.create('Ext.data.proxy.Direct', {
directFn: NFZDocumentService.Read,
paramOrder: 'start|limit|sort|filter|query',
paramsAsHash: false,
listeners: {
exception: function (thisProxy, response, operation, eOpts) {
var ex = 1;
}
},
reader: {
type: 'json',
root: 'Result',
totalProperty: 'TotalCount',
idProperty: 'BadanieID',
messageProperty: 'message',
listeners: {
exception: function () {
var ex = 1;
}
}
}
});


// Clone the config so we don't modify the original config object
config = Ext.apply({ proxy: proxy }, config);


//me.callParent( arguments ); // calls My.app.Panel's constructor
me.callParent([config]);

}
});


This is how I test it in some sample code(version with call that doesn't work):



Ext.Loader.setConfig({
enabled: true,
paths: {
'Ext.ux': 'extjs-4.1.1/ux',
'eSoft': 'app/eSoft',
'App': 'app'
}
});


Ext.application( {
name: 'App',
appFolder: 'app',


models: ['DictDefault', 'InvalidDocument', 'NFZDocument'],
stores: ['DictDefault', 'InvalidDocument', 'NFZDocument'],
controllers: [
'Shell',
'Login',
'Main',
'InvalidDocFilters'
],


// App start
launch: function () {
// Default language
var deflang = 'en';


// Direct provider
Ext.apply( Ext.app.REMOTING_API);
Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);




// Direct instantiation base on store definition
var tmpStore = Ext.create('App.store.NFZDocument');


// First test
tmpStore.on('load', function (storeInst, records, successful, eOpts) {
var rr = 0;
});


tmpStore.load();


//// Second test
//tmpStore.load(function (records, operation, success) {
// var oo = 0;
//});


This is the response sent to a client (browser) from server side:



[{"type":"rpc","tid":1,"action":"NFZDocumentService","method":"Read","result":{"TotalCount":0}}]


It doesn't matter if I send any data in test case - it doesn't fire event (or call callback) when I send any data there also. When I test first store in the same test case it works without any problems.

I was testing it (calling load on store) from different places also just to be sure it's not the issue with initial setup of framework and so on...

Thanks,
Alek