【问题标题】:Multiple API call in Single Grid单个网格中的多个 API 调用
【发布时间】:2018-02-26 13:34:17
【问题描述】:

我正在将数据绑定到剑道网格并具有以下架构。

     $("#divShowReports").kendoGrid({
            dataSource: {
                data: data,
                schema: {
                    model: {
                        fields: {
                            ReportID: { type: "string" },
                            ReportName: { type: "string" },
                            ReportQuery: { type: "string" },
                            IsAccessToAll: { type: "string" },
                            CustomerID: { type: "string" },
                            CustUserID: { type: "string" }
                        }
                    }
                },
                pageSize: 10,
            },
            sortable: true,
            filterable: true,
            columnMenu: true,
            pageable: true,
            columns: [{
                field: "ReportName", title: "Report Name",
                template: "<a value='#=ReportQuery#' href='javascript:void(0)' onclick=ShowAdhocGrid(this)>#=ReportName#</a>"
            },
                { field: "ReportID", title: "ReportID", hidden: true },
                { field: "ReportQuery", title: "Report Query" },
                { field: "IsAccessToAll", title: "Is Access to All" },
                { field: "CustUserID", title: "CustUserID" },
                { field: "CustomerID", title: "CustomerID" },

            ]
        });
    }

}

现在我从不同的 API 调用中获取“ReportQuery”字段值。请帮助我在不干扰其他事情的情况下如何将新数据合并到旧架构中。

谢谢

【问题讨论】:

    标签: asp.net json asp.net-web-api model-view-controller kendo-ui


    【解决方案1】:

    你自己在数据属性的网格上设置数据,对吧?

    假设您有多个 api 调用,添加一些承诺并跟踪所有调用何时完成,以便您准备好所有响应。

    然后,做任何你需要做的事情,合并数据集,更新你设置为数据集的对象上的某些字段,你不需要打扰任何事情。您可以控制字段的名称以及将哪些数据放入其中。

    您的所有工作基本上都是在数据源对象上完成的。

    【讨论】:

    • “你自己在数据属性的网格上设置数据,对吧?” NOPE.. 那是问题...我有受损的项目要处理..
    • 这没有任何意义,数据必须来自某个地方并且必须以某种方式分配。如果我的理解不正确,请您澄清一下这是怎么回事?
    猜你喜欢
    • 2013-12-26
    • 2018-05-10
    • 1970-01-01
    • 2020-03-07
    • 2018-10-24
    • 2021-05-05
    • 2011-03-15
    • 2016-04-04
    • 1970-01-01
    相关资源
    最近更新 更多