You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
firstly, I wish you a good year and hope great fun and nice stuff with javascriptmvc project.
I've tried to use model/list/local and it doesn't work.
store function should use $.toJSON
store : function(name){// go through and listen to instance updatingvarids=[],days=this.days;this.each(function(i,inst){window.localStorage[inst.identity()]=$.toJSON(instance.attrs());ids.push(inst.identity());});window.localStorage[name]=$.toJSON({type: this[0]&&this[0].constructor.fullName,ids: ids});returnthis;}
At the opposite, retrieve should be something like this:
retrieve : function(name){// each also needs what they are referencd by ?varprops,instances=[],Class;if(window.localStorage[name]){props=$.evalJSON(window.localStorage[name]);}props=props||{type : null,ids : []};Class=props.type ? $.String.getObject(props.type) : null;for(vari=0;i<props.ids.length;i++){varidentity=props.ids[i],instanceData=$.evalJSON(window.localStorage[identity]);instances.push(newClass(instanceData))}this.push.apply(this,instances);returnthis;}
The text was updated successfully, but these errors were encountered:
Hi,
firstly, I wish you a good year and hope great fun and nice stuff with javascriptmvc project.
I've tried to use model/list/local and it doesn't work.
store function should use $.toJSON
At the opposite, retrieve should be something like this:
The text was updated successfully, but these errors were encountered: