Load date from store to combobox

£可爱£侵袭症+ 提交于 2019-12-11 15:04:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!