Why my filter is not working in v2.ODataModel “read”?

前端 未结 3 892
太阳男子
太阳男子 2020-12-07 05:19

I am using the OData model to read data. But it doesn\'t work. Check the code below:

getGuid: function(pernr) {
  var          


        
3条回答
  •  隐瞒了意图╮
    2020-12-07 05:38

    1. Check if your OData service supports the $filter query in the first place.
    2. Use the read method correctly:
      myV2ODataModel.read("/PersonalDetailSet"/* No $filter queries here! */, {
        filters: [ // <-- Should be an array, not a Filter instance!
          new Filter({ // required from "sap/ui/model/Filter"
            path: "myField",
            operator: FilterOperator.EQ, // required from "sap/ui/model/FilterOperator"
            value1: "..."
          })
        ],
        // ...
      });
    • API reference: sap.ui.model.odata.v2.ODataModel#read
    • API reference: sap.ui.model.Filter

提交回复
热议问题