PDA

View Full Version : IE8 Store loading problem



ID91
27 Jun 2012, 4:49 AM
I have this store:



Ext.define("App.store.units.MyStore", {

extend:'Ext.data.Store',
requires: "App.model.units.MyModel",

model: "App.model.units.MyModel",
id:'myStore',
pageSize:10,
proxy: {
type: 'jsonp',
url: urls.MyUrl+"/search",
limitParam: 'undefined',
startParam: 'offSet',
pageParam: 'undefined',
extraParams: {
searchString: 'a'
},
reader: {
root: 'results.results',
totalProperty: 'numFound',
type: 'json'
}
}
});

The request works and I get the expected response.
For some reason, I got this in the browser(Firefox):


reader.read is not a function

But I have fixed it by adding a type:'json' in the reader config.

Here is also the (dynamic) definition of the model:



function(config){
try{
console.log("INIT MODEL");
Ext.define("App.model.units.MyModel", {
extend: 'Ext.data.Model',
fields: config
});
} catch(err){
console.log("Error");
}
}

This function is run before the store is created and the config object is an array of {name: 'value'} items.
I don't know what is wrong, because everything seems to run good in Firefox, but IE8 still has that error(even with the type:'json' in the reader). I think the reader isn't instatiated right in IE8, but I can't check it, since objects aren't displayed right in its console(or I don't have the knowledge to do so). Why doesn't the same javascript code run as it should?

EDIT It seems that the problems reoccurs on Firefox too. I do not know why, but the reader doesn't get instantiated as it should be.

mitchellsimoens
6 Jul 2012, 2:11 PM
What does your response look like?

ID91
9 Jul 2012, 3:57 AM
What response do you mean?

There isn't anything wrong about any response, as far as I know.

And by the way, I fixed this issue by setting the proxy in the model. It doesn't seem logical to me. It might be just a temporary fix and I might get to the same problem(or a different one) sooner or later.

Do you have any idea why this strange behavior occurred?

vivek bejawar
7 Dec 2012, 8:34 AM
Hi,
I am new to ExtJS. I have the below code. In the onReady function, the processMask function is called which displays loading message with revolving wheel.
And this gets hidden in the profile store on load function. But some times (very random, some times it is always, and some times it is once in 10 times etc) the onLoad function is not called and the wheel keeps revolving. Please help.


var profileStore,propStore, subPropStore, propListStore, permStore, permListStore, permLevelStore;

Ext.onReady(function(){
processMask(true, "Loading data...");
profileStore = Ext.data.StoreManager.lookup('profileUserStorelu');
propStore = Ext.data.StoreManager.lookup('propStorelu');
subPropStore = Ext.data.StoreManager.lookup('subPropStorelu');
propListStore = Ext.data.StoreManager.lookup('propListStorelu');
permStore = Ext.data.StoreManager.lookup('permStorelu');
permListStore = Ext.data.StoreManager.lookup('permListStorelu');
permLevelStore = Ext.data.StoreManager.lookup('permListStorelu');

var loadmask = new Ext.LoadMask(Ext.getBody(), { msg: 'loading Permissions' });

var tCellEdit = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1});

permissionDetailPanel = Ext.create('Ext.form.Panel', {
width: 650,
frame: true,
bodyPadding: 0,
layout: {
type: 'table',
columns: 2
},
defaults: {frame:true, width:250, height: 50},
fieldDefaults: {
labelAlign: 'right',
labelWidth: 90
},
items: [
{
xtype: 'box',
colspan:2,
height: 5,
width: 640,
autoDestroy: true,
autoEl: {tag: 'a', href: '#', html: '<span class="x-form-item" onClick="window.print()">Print</span>'}
},
{
.
.
.
.
});

permissionDetailPanel.render('permissionDetail');

profileStore.on('load', function() {

hideControl();
permissionDetailPanel.getForm().loadRecord(profileStore.getAt(0));

var profile_Role = permissionDetailPanel.getRecord().data.ProfileUserRole;
if(profile_Role=='WW'){
var permissionListgrid = Ext.getCmp('permissionListgrid');
//permissionListgrid.columns[1].disable(true);
}
processMask(false);
//loadmask.hide();
showControl();
//wwCheck(); // Coz for wwso the viewupdate save required for EAS Permissions
});

vivek bejawar
7 Dec 2012, 8:42 AM
And Here is my JSON store for e.g. Profile Store -

Ext.create('Ext.data.Store', {
model: 'ProfileUserModel',
storeId: 'profileUserStorelu',
clearOnPageLoad: true,
proxy: {
type: 'ajax',
url : 'EnvisionManager/faces/permission_manager.faces?method=doInitPermissionEdit',
timeout: 120000,
reader: {
type: 'json',
model: 'ProfileUserModel'
}
},
sorters: [{
property: 'Desc',
direction:'ASC'
}],
autoLoad: true
});

vivek bejawar
11 Dec 2012, 2:09 PM
I have fixed this.

Instead of using
profileStore = Ext.data.StoreManager.lookup('profileUserStorelu');

I have changed my code as below
(e.g. for one store)

Ext.onReady( function() {
Model definitions.

var profileStore = Ext.create('Ext.data.Store', { model: 'ProfileUserModel',
clearOnPageLoad: true,
//storeId: 'profileUserStorelu',
proxy: {
type: 'ajax',
url : <url here>,
timeout: 120000,
reader: {
type: 'json',
model: 'ProfileUserModel'
}
},
sorters: [{
property: 'Desc',
direction:'ASC'
}],
autoLoad: true
});

profileStore.load({
callback: function() {

hideControl();
// other stuff here

}
});


});