re_buchanan
5 Jan 2011, 11:17 AM
I'm having trouble figuring out why my store with a memory proxy is not loading exactly the same as my store with an ajax proxy. Both are loading the same data and using the same model, but the memory proxied store does not seem to be loading the model.
here's a snippet:
var fieldList = [
{name: 'LOC_TYPE', type: 'string'}
,{name: 'OPEN_CLOSED', type: 'string'}
,{name: 'id', type: 'string'}
,{name: 'loc_id', type: 'string'}
,{name: 'text', type: 'string'}
]
Ext.regModel('exec', {
fields: fieldList
,hasMany: {model: 'corp', name: 'corps'}
});
Ext.regModel('corp', {
fields: fieldList
,hasMany: {model: 'group', name: 'groups'}
,belongsTo: 'exec'
});
Ext.regModel('group', {
fields: fieldList
,hasMany: {model: 'division', name: 'divisions'}
,belongsTo: 'corp'
});
Ext.regModel('division', {
fields: fieldList
,hasMany: {model: 'branch', name: 'branches'}
,belongsTo: 'group'
});
Ext.regModel('branch', {
fields: fieldList
,hasMany: {model: 'team', name: 'teams'}
,belongsTo: 'division'
});
Ext.regModel('team', {
fields: fieldList
,belongsTo: 'branch'
});
var rollupTree = new Ext.data.Store({
model: 'exec'
,proxy: {
type: 'ajax'
,url: service_directory + 'rollup.rootedTree'
,reader: {
type: 'json'
,root: 'exec'
}
}
});
var rollupTreeNew = new Ext.data.Store({
model: 'exec'
,proxy: {
type: 'memory'
,reader: {
type: 'json'
,root: 'exec'
}
}
});
later the following statements load the data:
rollupTree.load();
rollupTreeNew.loadData(user.rolluptree);
(FYI, user is a global variable that is load on login - the user.rolluptree property contains exactly the same information as is returned by the ajax call to rollup.rootedTree)
I can elaborate further if need be.
Thanks
here's a snippet:
var fieldList = [
{name: 'LOC_TYPE', type: 'string'}
,{name: 'OPEN_CLOSED', type: 'string'}
,{name: 'id', type: 'string'}
,{name: 'loc_id', type: 'string'}
,{name: 'text', type: 'string'}
]
Ext.regModel('exec', {
fields: fieldList
,hasMany: {model: 'corp', name: 'corps'}
});
Ext.regModel('corp', {
fields: fieldList
,hasMany: {model: 'group', name: 'groups'}
,belongsTo: 'exec'
});
Ext.regModel('group', {
fields: fieldList
,hasMany: {model: 'division', name: 'divisions'}
,belongsTo: 'corp'
});
Ext.regModel('division', {
fields: fieldList
,hasMany: {model: 'branch', name: 'branches'}
,belongsTo: 'group'
});
Ext.regModel('branch', {
fields: fieldList
,hasMany: {model: 'team', name: 'teams'}
,belongsTo: 'division'
});
Ext.regModel('team', {
fields: fieldList
,belongsTo: 'branch'
});
var rollupTree = new Ext.data.Store({
model: 'exec'
,proxy: {
type: 'ajax'
,url: service_directory + 'rollup.rootedTree'
,reader: {
type: 'json'
,root: 'exec'
}
}
});
var rollupTreeNew = new Ext.data.Store({
model: 'exec'
,proxy: {
type: 'memory'
,reader: {
type: 'json'
,root: 'exec'
}
}
});
later the following statements load the data:
rollupTree.load();
rollupTreeNew.loadData(user.rolluptree);
(FYI, user is a global variable that is load on login - the user.rolluptree property contains exactly the same information as is returned by the ajax call to rollup.rootedTree)
I can elaborate further if need be.
Thanks