0

私はモデルを持っています:

Ext.define('SizoMag.model.SizoBuscetModel', {  extend: 'Ext.data.Model',
config: {
fields: [{name: 'text', type: 'string'}, {name: 'price', type: 'string'}],
proxy: {
  type: 'localstorage',
  id  : 'buscetmodel'
 }
}
});

保存する

Ext.define('SizoMag.store.SizoBuscetStore', {extend: 'Ext.data.Store',
 config: {
 storeId: 'SizoBuscetStore'
}
});

しかし、ストアにエントリを追加しようとすると、エラー [WARN][Ext.data.Operation#setModel] が発生します。メタデータを使用してモデルを定義しない限り、Operation にはモデルが定義されている必要があります。Console.js:35

[警告][Ext.data.reader.Reader#process] レコード データを読み取るために、Reader には Model が定義されている必要があります。Console.js:35

キャッチされていない TypeError: オブジェクトは関数ではありません

そう付け加えます

var store=Ext.getStore('SizoBuscetStore');
store.load();store.add({text:'txt',price:'150'});
store.sync();

助けてください / Tnx

4

2 に答える 2

0

代わりにこれを試してください。ストアのモデルタイプを定義して、リーダーを構成できるようにする必要があります。

Ext.define('SizoMag.store.SizoBuscetStore', {
    extend: 'Ext.data.Store',
    storeId: 'SizoBuscetStore',
    model: 'SizoBuscetModel'
});
于 2013-02-19T02:58:07.103 に答える
0

ちょっと簡単これを試してみてください

ストア内:

   Ext.define('e4b.store.Adult_DOBStore', {
extend: "Ext.data.Store",

config: {
    model: "e4b.model.Adult_DOBModel",
    autoLoad: true, 
    clearOnPageLoad: false,
}

         });

あなたのモデルは

           Ext.define('e4b.model.Adult_DOBModel', {
extend: 'Ext.data.Model',
config: {

    fields: ['Adult1Date'],


    proxy: {
        type: 'localstorage',
        id  : 'adultdob'
    }

       }

});

そして今、あなたのコントローラーで...

まず値を取得する

      var A_select1=Ext.getCmp('select1').getValue();

     localStorage.setItem("Adult1_select1",A_select1); //Assign the value to localstore

   var AdultSalutation={
                    // object                               
 'Adult1_select1':A_select1,

                 };

var AdultSalutationstore =Ext.getStore('Adult_AdultSalutationstore');// cal store 

        AdultSalutationstore.add(AdultSalutation);  // add the oject here
      AdultSalutationstore.sync();
   AdultSalutationstore.load();                           
于 2013-04-03T12:12:02.317 に答える