PDA

View Full Version : var store = this.up('[store]').store Error



sravaniv
5 Feb 2012, 11:25 PM
Hi guys,

While referring store in the grid, I'm getting the error :

this.up("[store]") is undefined (and the page contents do not get displayed) though I'm referring to it correctly.

Instead if I write
var termStore = Ext.create('srav.store.setting.Term.Store',{}); as a global variable, it works but sometimes gives an error 'c is not a constructor' . :-?

Can you please tell me what is the problem?

Thanks

Sravani

vietits
5 Feb 2012, 11:32 PM
It is difficult to say without looking at your code.

sravaniv
6 Feb 2012, 12:53 AM
here is the code:
view part :

var commentConfigPanel=Ext.create('Ext.form.Panel', {
itemId : 'commentConfig',
autoScroll : true,
margin : '50 0 0 0',
items : [
{
xtype:'container',
items:[
{
xtype : 'label',
text : 'Click to Edit',
margin : '15 0 0 10'
}, {
xtype : 'button',
text : 'Add Comment',
id : 'btnAddComment',
margin : '15 0 0 140'
}, {
xtype : 'label',
text : 'Place your mouse over a field for extra help.',
margin : '25 0 0 30'
}]}, {
xtype : 'gridpanel',
id : 'commentConfigGrid',
margin : '10 0 0 10',
bodyBorder : false,
stateful : true,
autoScroll : true,
selType : 'cellmodel',
plugins : [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1
})],
store : 'commentConfigId',
width : 310,
columns : [{
header : 'Comment',
dataIndex : 'comment',
editor : 'textfield',
width : 250
}, {
xtype : 'actioncolumn',
header : 'Delete',
align : 'center',
width : 60,
dataIndex : 'action',
items : [{
icon : 'images/close.png'
}],
handler : function(grid, row) {
var store = Ext.data.StoreManager
.lookup('setting.CommentConfig');
grid.store.removeAt(row);
}

}]

},
{
xtype : 'panel',
width : '100%',
layout: 'hbox',
items:[
{
xtype : 'button',
text : 'Cancel',
width:150,
margin:'40 0 0 230'
}, {
xtype : 'button',
width:150,
text : 'Save changes',
margin:'40 0 0 10'
}
]
}]
});

store:

Ext.define('srav.store.setting.CommentConfig',{
extend:'Ext.data.Store',
storeId:'commentConfigId',
model:'srav.model.setting.CommentConfigModel',
autoLoad:true,

proxy:{
type:'ajax',
url:'app/data/commentConfig.json',
reader:{
type:'json',
root:'comment',
successProperty:true
}
}
});

vietits
6 Feb 2012, 1:44 AM
I had a look at your code but I did see the line of code you mentioned in the first post of this thread (this.up("[store]")).

Note: For clarity, you should put your code between CODE tag.


var commentConfigPanel=Ext.create('Ext.form.Panel', {
itemId : 'commentConfig',
autoScroll : true,
margin : '50 0 0 0',
items : [{
xtype:'container',
items:[{
xtype : 'label',
text : 'Click to Edit',
margin : '15 0 0 10'
}, {
xtype : 'button',
text : 'Add Comment',
id : 'btnAddComment',
margin : '15 0 0 140'
}, {
xtype : 'label',
text : 'Place your mouse over a field for extra help.',
margin : '25 0 0 30'
}]
}, {
xtype : 'gridpanel',
id : 'commentConfigGrid',
margin : '10 0 0 10',
bodyBorder : false,
stateful : true,
autoScroll : true,
selType : 'cellmodel',
plugins : [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1
})],
store : 'commentConfigId',
width : 310,
columns : [{
header : 'Comment',
dataIndex : 'comment',
editor : 'textfield',
width : 250
}, {
xtype : 'actioncolumn',
header : 'Delete',
align : 'center',
width : 60,
dataIndex : 'action',
items : [{
icon : 'images/close.png'
}],
handler : function(grid, row) {
//var store = Ext.data.StoreManager.lookup('setting.CommentConfig');
//grid.store.removeAt(row);
grid.getStore().removeAt(row);
}
}]
},{
xtype : 'panel',
width : '100%',
layout: 'hbox',
items:[{
xtype : 'button',
text : 'Cancel',
width:150,
margin:'40 0 0 230'
}, {
xtype : 'button',
width:150,
text : 'Save changes',
margin:'40 0 0 10'
}]
}]
});


store:


Ext.define('srav.store.setting.CommentConfig',{
extend:'Ext.data.Store',
storeId:'commentConfigId',
model:'srav.model.setting.CommentConfigModel',
autoLoad:true,

proxy:{
type:'ajax',
url:'app/data/commentConfig.json',
reader:{
type:'json',
root:'comment',
successProperty:true
}
}
});

sravaniv
6 Feb 2012, 1:58 AM
Oh thanks for the info. :)

That line
var store = this.up('[store]').store is not in my code , it would be in ext-debug-all.js (line 79798).
When i run this , I get that error.

vietits
6 Feb 2012, 5:23 AM
Below is my solution for your problem (in red color):


var commentConfigPanel=Ext.create('Ext.form.Panel', { itemId : 'commentConfig',
autoScroll : true,
margin : '50 0 0 0',
items : [{
xtype:'container',
items:[{
xtype : 'label',
text : 'Click to Edit',
margin : '15 0 0 10'
}, {
xtype : 'button',
text : 'Add Comment',
id : 'btnAddComment',
margin : '15 0 0 140'
}, {
xtype : 'label',
text : 'Place your mouse over a field for extra help.',
margin : '25 0 0 30'
}]
}, {
xtype : 'gridpanel',
id : 'commentConfigGrid',
margin : '10 0 0 10',
bodyBorder : false,
stateful : true,
autoScroll : true,
selType : 'cellmodel',
plugins : [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit : 1
})],
store : Ext.data.StoreManager.lookup('commentConfigId'), //'commentConfigId',
width : 310,
columns : [{
header : 'Comment',
dataIndex : 'comment',
editor : 'textfield',
width : 250
}, {
xtype : 'actioncolumn',
header : 'Delete',
align : 'center',
width : 60,
dataIndex : 'action',
items : [{
icon : 'images/close.png'
}],
handler : function(grid, row) {
//var store = Ext.data.StoreManager.lookup('setting.CommentConfig');
//grid.store.removeAt(row);
grid.getStore().removeAt(row);
}
}]
},{
xtype : 'panel',
width : '100%',
layout: 'hbox',
items:[{
xtype : 'button',
text : 'Cancel',
width:150,
margin:'40 0 0 230'
}, {
xtype : 'button',
width:150,
text : 'Save changes',
margin:'40 0 0 10'
}]
}]
});

JoelRSimpson
20 Apr 2012, 1:22 PM
I was having this problem after moving a project into the new Sencha Architect tool. I had to go in to the application config and add the stores to the application to make the errors go away. I'm not sure this is the right/final solution, but that's as far as I've gotten so far.

Animal
21 Apr 2012, 5:47 AM
if "this.up('[store]') is undefined then you have some other problem.

That selects an ancestor container which has a store property.

So it should find the owning grid.

This implies that your owning grid does not have a store.

sridharstays
20 Sep 2012, 2:43 AM
We are evaluating the 4.1.2 and once we replace the files, we started getting the same error. With 4.1.1, the grid used to load just fine.

-Sri

GeoffreyRen
27 Oct 2012, 2:13 PM
one panel include the west grid and the center tabpanel. the tabpanel include two tab. one tab include a tree, the other include a grid. the first render was the right.But the error was render when you open second. there will right when I drop the center grid load function.


onload: function(store, records){
var selectedRecords = [];
Ext.Array.each(records, function(rec){
if (rec.data.IsDelete) {
selectedRecords.push(rec);
}
});
this.getSelectionModel().select(selectedRecords); this.getView().refresh(); }

And, there have the other problem. the tree load twice from server when you render the view again. the tree repeate showing the node.

skirtle
28 Oct 2012, 12:36 AM
For those observing this error with 4.1.2...

I ran into this same error message trying to use reconfigure. It happens when you don't pass a store to reconfigure. It seems to have been fixed in 4.1.3:

http://www.sencha.com/forum/showthread.php?243707

You can fix it by passing the current store to reconfigure.