Subclass of parse.com object in javascript properties after query -
i'm using parse.com backend project , creating web page using javascript.
i'm extending pfobject follow:
var match = parse.object.extend("match");
on match object have couple properties, let first 1 "player1"
my question how can make when try property of match object succeeds ie:
var matchquery = new parse.query("match"); matchquery.find({ success: function (results) { _.each(results, function (element, index, list) { // var test = element.player1 <<<< here player1 undefined }) }, error: function (error) { alert("error: " + error.code + " " + error.message); } });
thanks tips!
setting values on backbone object works regular js. value retained long object in memory, no longer.
match.memoryonlyattribute = "i'll gone soon";
if match released , queried again, memoryonlyattribute
null, have observed.
to value property persists, must first property on object. typically done in data browser "+ col" button. (it can done in code if clp permits).
with done, object can assigned persistent property values via set()
method...
var match = parse.object.extend("match"); var match = new match(); match.set("player1", /* object here of right type */); match.save();
once object retrieved, property in parse data can retrieved get()
method...
matchquery.first().then(function(matchresult) { var player1 = match.get("player1"); // player1 have value });
Comments
Post a Comment