javascript - Update and remove operation on Jaydata -
i'm trying write simple crud functionality in jaydata, had written simple code update operation:
sampleclass.prototype.load = function(input1,callback) { var param='it.name=="'+input1+'"'; this.data.items.filter(param).foreach(function(ii) { callback(ii); }); this.data.items.savechanges(); };
so when call:
t.load('entry4',function(res){console.log(res.name)})
it works charm! if call update operation callback like:
t.load('entry4',function(res){res.name="entry5"})
it doesn't change in db. have seen begintransaction function in http://jaydata.org/examples/jaydatapro/todolist_complex, couldn't understand essence of it.
special gabor dolla
in order update value in jaydata:
- db has have primary-key inside it.
- change non-key attributes
- call asynchronous save() function after it.
solution question is: after changing object field's definition this:
name{ type:'string', **key:true**}
you can query on change non-key attributes of them
t.load('entry4',function(res){res.lastname="entry5";res.save()});
Comments
Post a Comment