使用JavaScript解析指针联接查询 [英] Parse join query using Javascript pointer
问题描述
我有一个两解析对象内容和详细信息
I have a two parse objects 'Content' and 'Detail'
下面我在他们的数据浏览器添加两个类的屏幕截图。
Below I have added a screen shot of both classes in their data browsers.
我在内容被称为descId列这是明细对象OBJECTID是一个指向详细信息类。我需要知道如何从类中获取数据。这是我的尝试,但无功细节是不确定的。
I have a column in 'Content' called descId which is the Detail objects objectId and is a pointer to the 'Detail' Class. I need to know how to obtain data from both classes. This is my attempt but var Details is undefined.
var iBeacon = Parse.Object.extend('Details');
var content = Parse.Object.extend('Content');
var query = new Parse.Query(iBeacon);
query.include('descId');
query.find({
success: function(results) {
// // Do something with the returned Parse.Object values
for (var i = 0; i < results.length; i++) {
var object = results[i];
var Details = object.get('Details');
(function($) {
$('#iBeaconTable').append('<tr><td id = "uuid" >' + object.get('uuid') + '</td><td = "proxId">' + object.get('proximity') + '</td><td = "offerId">' + object.get('offer') + '</td><td class = "buttonRow"><Button id = "btnEdit" onclick = "openDialog()" class = "flat-button">Edit</Button><Button id = "btnDelete" onclick = "Delete()" class = "flat-button">Delete</Button></td></tr>');//<Button id = "editSave">Save</Button></td></tr>');
})(jQuery);
}
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
我拉我的头发就这一点,我真的需要挖掘出...问候。
I am pulling my hair out on this and I really need dig out...regards.
推荐答案
您被命名的内容的财产造成自己混乱
类 descId
。这解析内部使用的指针结构的ID事实上是一个实现细节,你不必担心,只要你的code是你将使用一个完整的详细而言
反对所有的时间。
You are causing yourself confusion by naming the property on the Content
class descId
. The fact that Parse internally uses a pointer structure with an ID is an implementation detail you don't need to worry about, as far as your code is concerned you'll be using a full Detail
object all the time.
在code实际的错误是这一行:
The actual error in your code is this line:
var Details = object.get('Details');
将其更改为:
// should be using the property name
var Details = object.get('descId');
这篇关于使用JavaScript解析指针联接查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!