首页 > 代码库 > SAPUI5 OData请求传参数

SAPUI5 OData请求传参数

例如要传para1, para2, para3

这里写代码片
var oModel = new sap.ui.model.odata.ODataModel(uri,
                                   true,
                                   user,
                                   password,
                                   headers);

// Create a simple list
var oTemplate1 =
    new sap.m.ColumnListItem({
        cells : [ new sap.m.Text({
                        text : "{MSG}"
                    }), 
                  new sap.m.Text({
                        text : "{ZCOUNTER}"
                    })
                ]
    });

oTable.setModel(oModel);

// Bind the items and template
oTable.bindAggregation("items", {
    path: "/CertificateSet",
    parameters: {    expand: "XXXXSSet" ,
                    custom:
                        {   para1: "20130101",
                            para2: "20120101" ,
                            par3: "4"
                        }
    }, 
    template: oTemplate1
});

如果 oData请求$expand=XXXXSSet,里面只有一条数据
参考:
https://archive.sap.com/discussions/thread/3559486
例子:
http://jsbin.com/openui5-hello-world/1001/edit?html,output

<script type="text/javascript"> $(function () { $(‘pre.prettyprint code‘).each(function () { var lines = $(this).text().split(‘\n‘).length; var $numbering = $(‘
    ‘).addClass(‘pre-numbering‘).hide(); $(this).addClass(‘has-numbering‘).parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($(‘
  • ‘).text(i)); }; $numbering.fadeIn(1700); }); }); </script>

    SAPUI5 OData请求传参数