本文介绍了ODataModel传递"expand"读取参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将扩展参数传递给 read ,因为如果我这样调用该服务将不起作用:

I'd like to pass expand parameters to read because it doesn't work if I call the service like this:

oModel1.read("/LinesSet?$expand=ToCells", {

推荐答案

read API希望将选项映射作为第二个参数,在其中我们可以使用属性urlParameters定义任何查询:

The read API expects a map of options as a second argument in which we can define any query using the property urlParameters:

oModel1.read("/LinesSet", {
    urlParameters: {
        "$expand": "ToCells"
    },
    success: this.onSuccess.bind(this),
    // ...
});

请不要忘记在expand之前加入$来表明这是一个系统查询.否则,它将被计为自定义查询.

Just don't forget to include $ before expand to indicate that it's a system query. Otherwise, it will be counted as a custom query.

这篇关于ODataModel传递"expand"读取参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 18:16