Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can anyone tell me why this bit of code doesn't create an entry into localstorage?

var myLocalStore = Ext.getStore('Default');
myLocalStore.load();
var now = new Date();
var cardId = (now.getTime()).toString() + (this.getRandomInt(0, 100)).toString();
var entry1 = { id: cardId, dateCreated: now, title: 'The Title', narrative: 'the Text' };
myLocalStore.add(entry1);
myLocalStore.sync();
console.log(entry1);

The console outputs :

    Object{id: "136575772251069", dateCreated: Fri Apr 12 2013 17:08:42 GMT+0800 (Taipei Standard Time), title: "The Title", narrative: "the Text"}
like image 287
Nirav Alagiya Avatar asked Feb 11 '14 14:02

Nirav Alagiya


1 Answers

Update: Success!

I updated my code to look like this;

var myLocalStore = Ext.getStore('Default');
var now = new Date();
var cardId = (now.getTime()).toString() + (this.getRandomInt(0, 100)).toString();
var entry = Ext.create('PinYin.model.Default', {id: cardId, dateCreated: now, title: "test", narrative: "narrative"});
entry.save();
console.log(entry);
like image 99
Nirav Alagiya Avatar answered Oct 20 '22 01:10

Nirav Alagiya