【问题标题】:URL parsing in .net core api.net core api 中的 URL 解析
【发布时间】:2020-11-14 18:40:48
【问题描述】:

对于网格,我在客户端使用了 jqwidget。从网格中过滤数据时,jqwidget 创建一个 url,如

https://localhost:44330/api/role/index?FilterGroups[0][field]=roleName&FilterGroups[1][field]=createdDate

在一个 .NET 核心站点中,我制作了一个这样的模型来获取该数据

还有这样的控制器

    [HttpGet("index")]
    public async Task<ResponseData<IndexData>> GetIndexData([FromQuery] PaginationQuery model)
    {
        return await _logic.GetIndexDataAsync(model);
    }

但我无法获得那些过滤器值

我怎样才能做到这一点??

【问题讨论】:

  • 请仅提供 C&P 代码 -- 不要显示代码图片。对于想要提供帮助的人来说,这让事情变得非常艰难。
  • 您可能应该将其从 GET 更改为 POST。这是一个非常复杂的查询字符串模型。
  • @Andy jqwidgets 有默认的get方法

标签: .net api .net-core jqwidget


【解决方案1】:

您能否尝试获取filter 事件并获取过滤器,设置为 post json 数据,然后像调用 api 调用一样

$("#jqxGrid").on("filter", function (event) 
{
    var filterinfo = $("#jqxgrid").jqxGrid('getfilterinformation');
    // convert filterinfo to your required model or use as it is 
    // post to the API and get response back.
}); 

【讨论】:

    猜你喜欢
    • 2018-02-05
    • 1970-01-01
    • 2018-03-25
    • 2013-12-08
    • 1970-01-01
    • 1970-01-01
    • 2020-03-26
    • 1970-01-01
    • 2017-04-06
    相关资源
    最近更新 更多