我有一个JavaScript表获取解析数据需要使用每行的objectid以便日后将它们存储在变量或类似的东西中
能帮助我吗?
干杯
更新1
以下是一些帮助
的代码var firstTeamResults = Parse.Object.extend(strUser);
var query = new Parse.Query(firstTeamResults);
query.startsWith("NameGame", ask4);
query.descending("updateAt");
query.find(
{
success: function(results)
{
for (var i = 0; i < results.length; i++)
{
var object = results[i];
(function($) {
$("#first-team-results-table").append("<tr><td>"
+ object.get("NameGame")
+ "</td><td>"
+ object.get("item")
+ "</td><td>"
+ "<input id='video' type='submit' value='Video'/>"
+ "</td><td>"
+ object.get("des")
+ "</td><td>"
+ object.get("group")
+ "</td><td>"
+ "<input id='more' type='submit' value='More'/>"
+ "</td></tr>");
})(jQuery);
}
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
})
});
答案 0 :(得分:0)
我想我明白你要问的是什么。在查询对象并获取它们之后,您可以在每个对象上调用.id方法来获取objectId。
请参阅下面的示例。
var YourClass = Parse.Object.extend("YourClassName");
var query = new Parse.Query(YourClass);
//An unconstrained Query to get all objects in the table
query.find({
success: function(results) {
for(var i=0; i <results.length; i++){
var objectId = results[i].id //This returns you the objectId of each row
//You can do what you want with objectId now.
}
},
error: function(object, error) {
// The object was not retrieved successfully.
// error is a Parse.Error with an error code and message.
}
});
Parse Docs表明您可以使用以下方法检索每个对象的三个特殊属性。
var objectId = yourObject.id;
var updatedAt = yourObject.updatedAt;
var createdAt = yourObject.createdAt;