persistence.js add() function not working

∥☆過路亽.° 提交于 2019-12-08 06:50:56

问题


I have tried to save an object to database:

Item = persistence.define('Item', {
imageUrl: "TEXT",
})

this is working,the imageUrl is set correctly:

var c = new Item({imageUrl: "a"});

this is not working, imageUrl is empty in the db

var c = new Item();
c.imageUrl = "a";

this is working:

var c = new Item();
c._data.imageUrl = "a";

Seems like a bug.


回答1:


I think I found the reason, If you are using jquery then you have to use: e. g.

obj.name(newValue) 

to set and

obj.name() 

to get attributs.

Can you please tell me where the documentation for such cases can be found? https://groups.google.com/forum/?fromgroups=#!topic/persistencejs/zph_wV1sEic



来源:https://stackoverflow.com/questions/13126293/persistence-js-add-function-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!