I m试图建立一个电网(Ext.grid.Panel
),并用数据填写。 但是,情况会错,因为电网显示无数据的空行。
模式是:
Ext.define( Order , {
extend: Ext.data.Model ,
fields: [
{
name: id ,
type: int
},
{
id: companyId ,
type: int
},
{
id: amount ,
type: int
},
{
id: dealDate ,
type: date
},
{
id: complete ,
type: int //boolean imitation
}
],
idProperty: id
});
Grid & Store代码:
var orders = Ext.create( Ext.data.Store , {
model: Order ,
proxy: Ext.create( Ext.data.proxy.Ajax , {
url: service/orders-data.php? ,
reader: Ext.create( Ext.data.reader.Json , {
root: orders
})
}),
sorters: [{
property: name ,
direction: ASC
}]
});
orders.load();
var ordersGrid = Ext.create( Ext.grid.Panel , {
width: 400,
height: 300,
store: orders,
columns: [
{
text: Amount ,
dataIndex: amount ,
width: 120
},
{
text: Deal date ,
dataIndex: dealDate ,
width: 120
},
{
text: Complete ,
dataIndex: complete ,
width: 120
}
]
});
服务器上的应急能力是:
{
"orders":[
{
"id":1,
"amount":5000,
"dealDate":"2012-01-05",
"complete":0
},
{
"id":2,
"amount":6850,
"dealDate":"2012-01-07",
"complete":0
},
{
"id":5,
"amount":7400,
"dealDate":"2012-01-09",
"complete":0
}
]
}
为什么电网显示空网?