0

我是 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()
});

但它不会为我填充列表。任何想法?

4

0 回答 0