html客户端通过查询以一对多关系获取相关集合 [英] html client get related collection in one to many relationship by query

查看:75
本文介绍了html客户端通过查询以一对多关系获取相关集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi

我有两个表(一对多关系). 研究 ResearchAttachment .每个 研究 包含多个特定的 <在HTML客户端中的strong>研究,我只能 研究 中的数据.如何获取

I have two tables (one to many relationship). Research and ResearchAttachment. Each Research contains more than one specific ResearchAttachment. when I tried to get the Research in html client, I can only get Research data in the first click. How Can I get the ResearchAttachment at the same time ?

我的问题是当我得到 研究 查询结果, ResearchAttachment.array.lenght 0.但是当我再次执行查询时. ResearchAttachment.array.lenght 

my problem is when I get the Research query result , the ResearchAttachment.array.lenght is 0. But when I do the query again. the ResearchAttachment.array.lenght is 2 . why this happened.

还有,我有浏览编辑查询_>属性_> ManageContainedData";什么都没有.

这是代码

/**
 * Created by chopic on 2014/11/5.
 */
screen.reasearchIDs = IDs;//excute the query

//when the query returns the selected Researches,do OrganizeByYear
screen.Researches.load().then(
    function (promiseItem) {
        OrganizeByYear(screen.Researches);
    });


function OrganizeByYear(researches) {
    var attachHashSet = [];
    for (var i = 0; i < researches.count; ++i) {
        var resItem = researches.data[i];

        if (resItem.ResearchAttachments) {
            //the resItem.ResearchAttachments.array.length == 0 when I first click the query button
            //however it works great after the  first query
            for (var j = 0; j < resItem.ResearchAttachments.array.length; ++j) {
                var attItem = resItem.ResearchAttachments.array[j];
                attachHashSet[attItem.Year] = attItem;
            }
        }
    }
}



推荐答案

实际上,我想知道如何无法在html客户端中以一对多关系获取相关集合.请告诉我如何.
actually, I want to know how can not get the related collection in one to many relationship in html client. please tell me how.


这篇关于html客户端通过查询以一对多关系获取相关集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆