PDA

View Full Version : this.proxy is undefined while using GridPanel!



ajanelisha
9 Jun 2011, 3:57 AM
Hello,
I am very new to Ext JS and would be very thankful if any of you could help me out in this-
I am getting "this.proxy is undefined" error in firebug while using GridPanel. I am showing data stored in myData in GridPanel.


var myData = {"totalCount":"7",
"topics":
[{"title":"A","threadid":"1","username":"x","userid":"2","dateline":"1","postid":"6","forumtitle":"E","forumid":"4","replycount":"2","lastpost":"1","lastposter":"x","excerpt":"H"},
{"title":"h?","threadid":"3","username":"i","userid":"1","dateline":"1","postid":"33","forumtitle":".x","forumid":"0","replycount":"5","lastpost":"6","lastposter":"r","excerpt":"ok."},
{"title":"S","threadid":"2","username":"D","userid":"9","dateline":"3","postid":"0","forumtitle":"gs","forumid":"41","replycount":"0","lastpost":"1305857168","lastposter":"z","excerpt":"Ext"},
{"title":"UXML","threadid":"4","username":"c","userid":"3","dateline":"4","postid":"5","forumtitle":":Help","forumid":"40","replycount":"0","lastpost":"30","lastposter":"8","excerpt":"T"},
{"title":"O.","threadid":"9","username":"r","userid":"6","dateline":"34","postid":"14","forumtitle":"n","forumid":"68","replycount":"0","lastpost":"134","lastposter":"wa0","excerpt":"W"},
{"title":"XML","threadid":"12","username":"8","userid":"7","dateline":"30","postid":"65","forumtitle":"Help","forumid":"1","replycount":"0","lastpost":"170","lastposter":"cnn", "excerpt":"T"},
{"title":"send","threadid":"0","username":"_08","userid":"23","dateline":"3","postid":"53","forumtitle":"p","forumid":"30","replycount":"0","lastpost":"70","lastposter":"cay8","excerpt":"T"} ]}

var store = new Ext.data.Store ({
remoteSort : false,
autoLoad : { params:
{start:0, limit:2}
},
reader : new Ext.data.JsonReader({
root : 'topics',
totalProperty : 'totalCount',
idProperty : 'threadid',
fields: [
'title', 'forumtitle', 'forumid', 'author',
{name: 'replycount', type: 'int'},
{name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
'lastposter', 'excerpt'
]
})
});

store.loadData(myData);

var grid = new Ext.grid.GridPanel({
renderTo : Ext.getBody(),
width : 700,
height : 500,
frame : true,
title : 'Available Sources',
trackMouseOver : false,
autoExpandColumn : 'topic',
store : store,

columns: [new Ext.grid.RowNumberer({width: 30}),{
id : 'topic',
header : "Date",
dataIndex : 'title',
width : 420,
//renderer : renderTopic,
sortable : true
},{
header : "Type",
dataIndex : 'replycount',
width : 70,
align : 'right',
sortable : true
},{
id : 'last',
header : "Description",
dataIndex : 'lastpost',
width : 150,
//renderer : renderLast,
sortable : true
}],

bbar: new Ext.PagingToolbar({
store : store,
pageSize : 2,
displayInfo : true
}),

});
grid.render(Ext.getBody());

SimoAmi
9 Jun 2011, 1:36 PM
I think the problem is with the autoLoad attribute. You need to remove it as it instructs the store to perform a load() operation and that will definitely throw an error since you didn't define a proxy.

You're already using loadData() and that's your "autoLoad" for static data.

ajanelisha
9 Jun 2011, 11:39 PM
I already tried that but it didn't seem to work. Any other suggestion?

skirtle
10 Jun 2011, 12:59 AM
You seem to be using paging with local data. How exactly do you expect that to work?

SimoAmi
11 Jun 2011, 2:08 PM
I already tried that but it didn't seem to work. Any other suggestion?

It worked when I tested it locally. In addition to autoLoad, drop the paging toolbar as you're fetching off of static data.