extjs的localstorage组合框的一个例子

时间:2013-02-26 21:32:44

标签: extjs

我是extjs的新手,并尝试使以下代码有效:

我按照你的建议尝试,但仍然没有运气:

var bookmarks=[];
bookmarks[0] ={id:'111111111', target:'target', title:'title', category:'category', created:'created'};
bookmarks[1] ={id:'22222222222', target:'target', title:'title22222222', category:'category', created:'created'};
localStorage['myapp-bookmarks']=JSON.stringify(bookmarks);

Ext.define("BookMark", {
    extend: 'Ext.data.Model', 
    idProperty: "id",
    fields: ['id','target','title','category','created'] 
});

var bookmarkStore = Ext.create("Ext.data.Store", {
    model: "BookMark",
    autoLoad: true,
    storeId: 'bookmarks',
    proxy: {
        type: 'localstorage',
        id  : 'myapp-bookmarks'
    }
});

// Create the combo box, attached to the above store
Ext.create('Ext.form.ComboBox', {
    fieldLabel: 'Choose State',
    store: bookmarkStore,
    queryMode: 'local',
    displayField: 'title',
    valueField: 'id',
    renderTo: Ext.getBody()
});

但它不会为我填充列表。有什么想法吗?

0 个答案:

没有答案