将 ExtJs 4 网格过滤器信息绑定到 asp.net mvc 操作参数的最佳方法是什么?
将 ExtJs 4 Grid 过滤器信息绑定到 asp.net mvc 操作参数的最佳方法是什么?
我编写了这些辅助类:
public class ExtFilterInfo
{
public string Field { get; set; }
public ExtFilterData Data { get; set; }
}
public class ExtFilterData
{
public string Type { get; set; }
public string Value { get; set; }
}
这是操作:
public ActionResult Grid(int start, int limit, string sort, ExtFilterInfo[] filter)
QueryString 看起来像这样:
_dc:1306799668564
filter%5B0%5D%5Bfield%5D:Nome
filter%5B0%5D%5Bdata%5D%5Btype%5D:string
filter%5B0%5D%5Bdata%5D%5Bvalue%5D:nu
page:1
start:0
limit:20
What's the best way to bind ExtJs 4 Grid filter info to asp.net mvc action parameters?
I wrote these helper classes:
public class ExtFilterInfo
{
public string Field { get; set; }
public ExtFilterData Data { get; set; }
}
public class ExtFilterData
{
public string Type { get; set; }
public string Value { get; set; }
}
Here is the Action:
public ActionResult Grid(int start, int limit, string sort, ExtFilterInfo[] filter)
The QueryString looks something like this:
_dc:1306799668564
filter%5B0%5D%5Bfield%5D:Nome
filter%5B0%5D%5Bdata%5D%5Btype%5D:string
filter%5B0%5D%5Bdata%5D%5Bvalue%5D:nu
page:1
start:0
limit:20
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
自定义模型绑定器看起来可以满足要求:
可以在
Application_Start
中注册:现在控制器操作作为参数的
filter
集合应该正确绑定。A custom model binder looks like it could fit the bill:
which could be registered in
Application_Start
:and now the
filter
collection which your controller action takes as argument should be bound correctly.