如何在javascript中将格式化的Pageable json对象发送给Spring API

我想发送“ ASC ”或“ DESC ”查询的方向/顺序作为可分页对象的一部分。所以我的问题是,即使我将Direction设置为pageable的值,并且API URL Request中包含此信息,Spring后端也无法正确解析Pageble对象,并且始终将 ASC 显示为Direction (我认为这可能是默认状态)。

这是我在Angular控制器中的过滤方法

Controller.prototype.sortByDate = function(asc_desc,isStartDate){
        this.pageable.sort = isStartDate ? "validityStartDate" : "validityEndDate";
        this.pageable.direction = asc_desc;
        this.service.findAll(this.filter,this.pageable).then(function(data){
            this.magazineCollectionSubscriptionList = data.content;
            this.setupPagination( data.totalElements );
            this.changePageSize(size,this.filter);
        }.bind(this));
    }

这是我在此实体服务中的API调用

Service.prototype.findAll = function(filter,pageable){
        return this.httpService.post(this.serviceUrl + '/list',filter,{ params: pageable });
};

这是它创建的请求

如何在javascript中将格式化的Pageable json对象发送给Spring API

这是IDE上的调试显示

如何在javascript中将格式化的Pageable json对象发送给Spring API

iCMS 回答:如何在javascript中将格式化的Pageable json对象发送给Spring API

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2104901.html

大家都在问