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

前端 未结 3 900
太阳男子
太阳男子 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:41

    If you want to apply additional URL Parameters in the read function you have to do this via the "urlParameters" parameter:

    getGuid: function(pernr){
        var self = this;
        var url = "/PersonalDetailSet";
        self.setBusy(true);
        this.oModel.read(url, {
            urlParameters: {
                "$filter" : "Pernr eq '00000001'"
            },
            success: function(res){
                self.setBusy(false);
                self.guid = res.results[0].Guid;
            },
            error: function() {
                self.setBusy(false);
            }
        });
    }
    

提交回复
热议问题