问题
Hello i am get from server date to store with "url: /book/price" . And this response comes from the server
{
status: "SUCCESS",
msg: "операция завершена успешно",
data: [
"500",
"600"
]
}
This information from "data" I want to insert in combobox. I am create store, but don't know what write there: this store:
Ext.define('TPL.store.price.Book', {
extend: 'Ext.data.BaseStore',
autoLoad: true,
proxy: {
type: 'ajax',
url: '/book/price',
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
}
}});
And in combobox i am don't know what write in valuefield
{
xtype: 'combobox',
width: 350,
store: 'price.Book',
valueField: '???'
}
Thanks for all answers
回答1:
your proxy should be:
proxy: {
type: 'ajax',
url: '/book/price',
reader: {
type: 'json',
root: 'data',
successProperty: 'status' <-
}
}
and you can ommit the valueField
property if your store has data in array format.
来源:https://stackoverflow.com/questions/23058702/load-date-from-store-to-combobox