PDA

View Full Version : data not display----directstore grid



netbox
24 Dec 2009, 1:31 AM
grid rows is empty,but bbar can display




Ext.ns('Ext.app');
Ext.Direct.addProvider(Ext.app.REMOTING_API);
Ext.onReady(function() {

var myDs = new Ext.data.DirectStore({
paramsAsHash: true,
paramOrder: ['start', 'limit'],
directFn: DataBLL.griddata,
root: 'rows',
totalProperty: 'totalcount',
idProperty: 'AID',
fields: [{
name: 'AID',
type: 'int'
}, {
name: 'ATitle',
type: 'string'
}, {
name: 'Acontent',
type: 'string'
}, {
name: 'DateStart',
mapping: 'DateStart'
}, {
name: 'DateEnd',
mapping: 'DateEnd'
}, {
name: 'Palace',
type: 'string'
}, {
name: 'AUser',
type: 'int'
}, {
name: 'AddTime',
mapping: 'AddTime'
}, {
name: 'AType'
}]


});

var cm = new Ext.grid.ColumnModel({
header: '',
dataIndex: 'AID',
hidden: true
}, {
header: 'ATitle',
dataIndex: 'ATitle'
}, {
header: 'Acontent',
dataIndex: 'Acontent'
}, {
header: 'DateStart',
dataIndex: 'DateStart'

}, {
header: 'DateEnd',
dataIndex: 'DateEnd'

}, {
header: 'AddTime',
dataIndex: 'AddTime'

}, {
header: 'AType',
dataIndex: 'AType'
}

);
cm.defaultSortable = true;
grid = new Ext.grid.GridPanel({
store: myDs,
cm: cm,
height: 200,
title: 'list',
bbar: new Ext.PagingToolbar({
pageSize: 20,
store: myDs,
displayInfo: true,
displayMsg: 'display {0} to {1} ,total {2} ',
emptyMsg: "no record"
})

});

grid.render('gdiv');
myDs.load({
params: {
start: 0,
limit: 20
}
});
});



server response




{
"type": "rpc",
"tid": 2,
"action": "DataBLL",
"method": "griddata",
"result": {
"totalcount": 2,
"rows": [
{
"AID": 2,
"ATitle": "222",
"Acontent": "222",
"DateStart": "\/Date(1236851880000)\/",
"DateEnd": "\/Date(1238497560000)\/",
"AUser": "0 ",
"AddTime": "\/Date(1238234322860)\/",
"AType": "?? "
},
{
"AID": 6,
"ATitle": "test",
"Acontent": "test",
"DateStart": "\/Date(1239852660000)\/",
"DateEnd": "\/Date(1240975860000)\/",
"AUser": "admin ",
"AddTime": "\/Date(1239161553827)\/",
"AType": "?? "
}
]
}
}