PDA

View Full Version : Error While Loading store in ExtJS MVC



rushi2440
23 Feb 2012, 5:29 AM
hi. forum members I need your support.

I am working on EXtJS MVC. and I am Creating Scheduler.

In that In My View I am Loading My Store but getting Error Like this.getResourceStore is not a function.

My Event Store is

Ext.define('gantt.store.eventStore', {
extend: 'Ext.data.JsonStore',
model: 'gantt.model.event'
});
My Resource Store is

Ext.define('gantt.store.resourceStore', {
extend: 'Ext.data.JsonStore',
model: 'gantt.model.resource',
autoload: true,
proxy: {
type: 'ajax',
url: 'data/data.js',


reader: {
type: 'json',
root: 'staff'
}
},
sortInfo: { field: 'Id', direction: "ASC" }
});


and my Scheduler View is

createScheduler: function () {
var start = new Date(2011, 1, 7, 8);
var ds = Ext.create("gantt.view.schedulermgt.demoScheduler", {
width : 1030,
height : 400,
renderTo : Ext.getBody(),

resourceStore : Ext.create('gantt.store.resourceStore'),
eventStore : Ext.create('gantt.store.eventStore'),
// resourceStore :Ext.data.StoreManager.lookup('resourceStore'),
// eventStore :Ext.data.StoreManager.lookup('eventStore'),

viewPreset : 'hourAndDay',

startDate : start,
endDate : Sch.util.Date.add(start,Sch.util.Date.HOUR, 10),

listeners : {
scope : this
}
});

this.getResourceStore().load();
return ds;


I am accessing my Store Either Ext.create('gantt.store.resourceStore') or Ext.data.StoreManager.lookup('resourceStore') way but I am getting Error this.getResourceStore is not a function.
Archana Mistry
Sr. Programmer
Kintudesigns.com

vietits
23 Feb 2012, 6:13 AM
See my comment in the code below:


createScheduler: function () {
var start = new Date(2011, 1, 7, 8);
var ds = Ext.create("gantt.view.schedulermgt.demoScheduler", {
width : 1030,
height : 400,
renderTo : Ext.getBody(),


resourceStore : Ext.create('gantt.store.resourceStore'),
eventStore : Ext.create('gantt.store.eventStore'),
// resourceStore :Ext.data.StoreManager.lookup('resourceStore'),
// eventStore :Ext.data.StoreManager.lookup('eventStore'),


viewPreset : 'hourAndDay',


startDate : start,
endDate : Sch.util.Date.add(start,Sch.util.Date.HOUR, 10),


listeners : {
scope : this
}
});


// this.getResourceStore().load(); <- It seems that this line causes error
ds.resourceStore.load(); // fix
return ds;
}

rushi2440
23 Feb 2012, 10:30 PM
hi vietit

Thanks a lot for your response..
solved my this error but now I am getting error like...url is undefined.


initComponent: function() {
console.log("Enter Init");
this.scheduler = this.createScheduler();
console.log("Scheduler : " + scheduler);
this.initStoreEvents();
},




createScheduler: function () {
var start = new Date(2011, 1, 7, 8);
var ds = Ext.create("gantt.view.schedulermgt.demoScheduler", {
width : 1030,
height : 400,
renderTo : Ext.getBody(),
resourceStore : Ext.create('gantt.store.resourceStore'),
eventStore : Ext.create('gantt.store.eventStore'),
viewPreset : 'hourAndDay',
startDate : start,
endDate : Sch.util.Date.add(start,Sch.util.Date.HOUR, 10),
listeners : {
scope : this
}
});

ds.getResourceStore().load();
return ds;
}


Getting Error from createScheduler.

Archana Mistry
Sr. Programmer
Kintudesigns.com

vietits
24 Feb 2012, 12:56 AM
What is ds.getResourceStore()? Why don't you use ds.resourceStore instead?


createScheduler: function () {
var start = new Date(2011, 1, 7, 8);
var ds = Ext.create("gantt.view.schedulermgt.demoScheduler", {
width : 1030,
height : 400,
renderTo : Ext.getBody(),
resourceStore : Ext.create('gantt.store.resourceStore'),
eventStore : Ext.create('gantt.store.eventStore'),
viewPreset : 'hourAndDay',
startDate : start,
endDate : Sch.util.Date.add(start,Sch.util.Date.HOUR, 10),
listeners : {
scope : this
}
});


ds.getResourceStore().load();
return ds;
}

rushi2440
24 Feb 2012, 1:11 AM
hi vietits

Solved my problem
Thanks a lot for your response..

Archana Mistry
Sr. Programmer
Kintudesigns.com