Ext.define('Bill', {
extend: 'Ext.data.Model',
fields: [
{ name: 'bid', type: 'number' },
{ name: 'incAndExp', type: 'string' },
{ name: 'type', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'price', type: 'number' },
{ name: 'quantity', type: 'number' },
{ name: 'time'},
{ name: 're', type: 'string' }
]
});Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
model: 'Bill',
pageSize: 10,
autoLoad: true,
proxy: {
type: 'ajax',
actionMethods: {read: 'POST' },
url: 'search',
reader: {
type: 'json',
root: 'bills',
totalProperty: 'totalCount',
}
}
});后台传过来的数据如下:{
"count":432.0,
"totalCount":3,
"success":true,
"bills":[
{"bid":5,"incAndExp":"1","type":"1","name":"sd","quantity":12.0,"price":12.0,"time":1376323200000,"re":null},
{"bid":6,"incAndExp":"2","type":"2","name":"121","quantity":12.0,"price":12.0,"time":1376496000000,"re":null},
{"bid":7,"incAndExp":"3","type":"3","name":"dsf","quantity":12.0,"price":12.0,"time":1376496000000,"re":null}
]
}我怎么才能得到"count":432.0 这条数据?ext4javascriptjson
extend: 'Ext.data.Model',
fields: [
{ name: 'bid', type: 'number' },
{ name: 'incAndExp', type: 'string' },
{ name: 'type', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'price', type: 'number' },
{ name: 'quantity', type: 'number' },
{ name: 'time'},
{ name: 're', type: 'string' }
]
});Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
model: 'Bill',
pageSize: 10,
autoLoad: true,
proxy: {
type: 'ajax',
actionMethods: {read: 'POST' },
url: 'search',
reader: {
type: 'json',
root: 'bills',
totalProperty: 'totalCount',
}
}
});后台传过来的数据如下:{
"count":432.0,
"totalCount":3,
"success":true,
"bills":[
{"bid":5,"incAndExp":"1","type":"1","name":"sd","quantity":12.0,"price":12.0,"time":1376323200000,"re":null},
{"bid":6,"incAndExp":"2","type":"2","name":"121","quantity":12.0,"price":12.0,"time":1376496000000,"re":null},
{"bid":7,"incAndExp":"3","type":"3","name":"dsf","quantity":12.0,"price":12.0,"time":1376496000000,"re":null}
]
}我怎么才能得到"count":432.0 这条数据?ext4javascriptjson
上面这个就是你传给store的json串,取到后想怎么用怎么用。