PDA

View Full Version : loading error of paging grid



yesky2006
1 Jul 2007, 3:04 AM
Ext.onReady(function(){

var ds = new Ext.data.Store({
proxy: new Ext.data.ScriptTagProxy({
url: 'EchoJson.json'
}),

reader: new Ext.data.JsonReader({
root: 'records',
totalProperty: 'totalCount',
id: 'id'
}, [
{name: 'name', mapping: 'name'},
{name: 'pwd', mapping: 'pwd'},
{name: 'lastip', mapping: 'lastip'},
{name: 'lastLogin', mapping: 'lastLogin'}
]),

remoteSort: true
});
ds.setDefaultSort('name', 'asc');

var cm = new Ext.grid.ColumnModel([{
id: 'id',
header: "id",
dataIndex: 'id',
width: 0,
hidden: true
},{
header: "name",
dataIndex: 'name',
width: 70
},{
header: "pass word",
dataIndex: 'pwd',
width: 170,
align: 'right'
},{
header: "last login ip",
dataIndex: 'lastip',
width: 170,
align: 'right'
},{
header: "last login",
dataIndex: 'lastLogin',
width: 100
}]);

cm.defaultSortable = true;

var grid = new Ext.grid.Grid('list-div', {
ds: ds,
cm: cm,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
enableColLock:false,
loadMask: true
});

var rz = new Ext.Resizable('list-div', {
wrap:true,
minHeight:100,
pinned:true,
handles: 's'
});
rz.on('resize', grid.autoSize, grid);

grid.render();

var gridFoot = grid.getView().getFooterPanel(true);

var paging = new Ext.PagingToolbar(gridFoot, ds, {
pageSize: 25,
displayInfo: true
});

ds.load({params:{start:0, limit:25}});
});



The data url returns

({
"records":[
{"lastip":"","name":"sa","lastLogin":"2007-05-01 00:00:00.0","id":"sa","pwd":"123"},
{"lastip":"","name":"123","lastLogin":null,"id":"test","pwd":"123"}],
"totalCount":2
})

When open the page, the grid shows, but it keeps loading data.
Is my json data returns in error format?

yesky2006
1 Jul 2007, 4:33 AM
The problem I posted is like this.

I follow the page grid example of ext docs,
I click the www.yui-ext.com/forum2/topics-remote.php url and
save the json data into one text file 'json.txt',
then copy the json.txt to the same directory of paging.html and
modify url of ScriptTagProxy from "topics-remote.php" to "json.txt" in the paging.js file.

When I open the new paging.html, It shows the grid, but loading dialog pop out and
can't not really bring data into grid.

Why?

tryanDLS
1 Jul 2007, 4:34 AM
Why are you using ScriptTagProxy rather than HtttpProxy? What is that url - is it valid? Look at firebug - is the request coming back?

yesky2006
1 Jul 2007, 4:52 AM
thank you for your quick reply.

I just follow the example of ext doc where ScriptTagProxy is used.

Now I use HttpProxy, it works.

The url is my java serverlet which response json data with remote sorting and pagination.