2013-10-10 25 views
0

数据保存到本地storage.Saving时工作正常进行me.but煎茶保存到localStorage的警告

store.sync()

生成警告我得到一个警告...

“[WARN] [Ext.data.Batch#runOperation]模型的标识符生成策略不能确保唯一的标识符,请使用UUID策略,或者使用标志isUnique实现您自己的标识符策略。

当我寻找解决方案时,我发现它是模型ID的问题..在我的情况下,我直接给商店中的字段。没有对我的模型文件。我尝试了一些solution.nothing为我工作。希望你能understand.Pls帮我

这是我的代码提前

回答

0

Ext.define('MyAppp.store.MyStore', { 
     extend:'Ext.data.Store', 
     requires:['Ext.data.proxy.LocalStorage'], 
     config: { 
      remoteSort : true, 
      identifier: { 
       type: 'uuid' 
      }, 
      fields:[ 
       {name:'firstname',type:'string'},  
       {name:'lastname',type:'string'}, 
       {name:'userID',type:'number'} 
      ], 
      proxy: { 
       type :'localstorage', 
       id:'LogInStore' 
      } 
     } 
}); 

由于这是一个错误煎茶触摸的2.0.1版本之前。

在这里看到: http://www.sencha.com/forum/showthread.php?185132-LocalStorage-proxy-using-id-that-is-not-an-integer-(32-digit-hex)

我有同样的问题。解决办法是:

identifier: { 
       type: 'uuid' 
      }, 

什么,你已经在你的设置。