(this is a duplicate of Stackoverflow's topic).
Hello everyone,
after a lot of googling and debugging, I can't figure it out why I get an error when using UUID strategy in my Model instance.I am using localStorage to store remote data on the user's device, ST2 recommands (they says "you need") to use an UUID identifier in my model instance to generate unique ID.If I don't, I get :
Code:
[WARN][Anonymous] Your identifier generation strategy for the model does not ensure unique id's. Please use the UUID strategy, or implement your own identifier strategy with the flag isUnique.
If I do it, I get
Code:
Uncaught TypeError: Cannot call method 'substring' of undefined
Here is my Model :
Code:
Ext.define("MyApp.model.News", {
extend: 'Ext.data.Model',
config : {
idProperty: "localId",
identifier: {
type: 'uuid'
},
fields : [ {
name: "localId",
type: "auto"
},{
name : "id",
type : "integer"
}, {
name : "title",
type : "string"
}[...]],
proxy: {
type: 'localstorage',
id : 'proxyNews'
}
}
});
And the localStorage store :
Code:
Ext.define('MyApp.store.NewsLocalStorage', {
extend: "Ext.data.Store",
config: {
storeId: 'newsLocalStorage',
model: "Lmde.model.News",
autoLoad: true
}
});
What am I missing ?