jqGrid 与 Html.Grid 助手

发布于 2024-10-15 12:53:15 字数 503 浏览 2 评论 0原文

我已经使用 jqGrid 作为数据的网格视图有一段时间了。它运行良好,并且很容易实现到我的解决方案中。然而,由于项目中正在进行一些重构,我又重新研究了它。

该项目本身是围绕 ASP.NET MVC 2 (.NET 4.0) 构建的。我们需要一些额外的功能,例如:

  • 能够添加列。
  • 列的内联编辑。
  • 排序
  • 过滤器
  • 分页
  • 搜索

jqGrid 完成了所有这些(尽管尚未实现所有这些功能 - 其中一些是基于新需求的新功能)。但是,考虑到我正在使用 ASP.NET MVC,我想知道切换到 Html.Grid 帮助器是否更有意义。对于我知道它可以做的事情(排序/过滤/分页)来说,它看起来很容易实现,但我不知道它是否可以完成其他任务(以相当简单的方式) - 我发现的任何东西似乎都有点“很黑客。”

任何人都可以启发我 A.) Html.Grid 到 jqGrid 的功能和 B.) 如果有任何原因我想采用 Html.Grid。

I have been using jqGrid as my grid view to my data for some time now. It works well and it was easy to implement into my solution. However, due to some refactoring going on within the project right now, I have been looking into it again.

The project itself is built around ASP.NET MVC 2 (.NET 4.0). We need some extra functionality such as:

  • Being able to add columns.
  • Inline editing of columns.
  • Sorting
  • Filter
  • Paging
  • Searching

jqGrid does all of this (although, not all of this functionality is implemented yet - some of it is new based on new needs). But, given that I am using ASP.NET MVC, I was wondering if it would make more sense to switch to the Html.Grid helper. It looks just as easy to implement for the things I know it can do (Sorting/Filtering/Paging), but I do not know if it can even do the other tasks (in a fairly straightforward manner) - anything I have found seems somewhat "hackish."

Can anybody enlighten me on A.) the capabilities of Html.Grid to jqGrid and B.) if there is any reason I'd want to take Html.Grid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云裳 2024-10-22 12:53:15

我成功地将 jqGrid 与 ASP.NET MVC 2 (.NET 4.0) 结合使用,并具有您在问题中描述的所有功能。而且所有有jqGrid的页面看起来都非常简单。

我不使用 Html.Grid 或任何 MVC 控件。我在页面上仅包含纯 HTML 片段

。此外,我还包含了将“列表”表和“寻呼机”div 初始化为 jqGrid 的 JavaScript。因此,该实现独立于 MVC 概念。 jqGrid 集成最重要的部分是返回纯 JSON 输出以及使用 jqGrid 实现 GET/PUT/POST/DELETE 操作的操作。您可以在此处阅读有关该方法的更多信息 (另请参阅答案中包含代码示例的许多链接)。

确切地说,我更喜欢使用 WCF 作为 ASP.NET MVC 解决方案的一部分,并且 WCF 方法提供 jqGrid 所需的数据(请参阅 此处了解更多详细信息),但您可以将所有内容实现为纯 ASP.NET MVC 操作。

如果您为 ASP.NET MVC 站点使用单元测试,则可以成功为 jqGrid 使用的 WFC 方法或控制器操作编写测试。通过这种方式,您将测试 jqGrid 实现的大部分部分。

I use jqGrid successfully with ASP.NET MVC 2 (.NET 4.0) and have all the features which you describe in your question. Moreover all pages having jqGrid looks like very simple.

I don't use Html.Grid or any MVC controls. I include just pure HTML fragment <table id="list"></table><div id="pager"></div> on the page. Additionally I include the JavaScript which initialize the "list" table and the "pager" div as the jqGrid. So the implementation is independent from MVC concept. The most important part of the jqGrid integrations is the actions which get back pure JSON output and which implement GET/PUT/POST/DELETE operations with the jqGrid. You can read more about the approach here (see also many links with code examples included in the answer).

To be exactly I prefer to use WCF as a part on my ASP.NET MVC solution and the WCF methods provide the data needed for jqGrid (see here more details), but you can implement all as pure ASP.NET MVC actions.

If you use Unit testes for you ASP.NET MVC site you can successfully write tests for WFC methods or controller actions used by jqGrid. In the way you will test the most parts of jqGrid implementation.

娇女薄笑 2024-10-22 12:53:15

在查看了这两种方法之后,我认为 jqGrid 对于我尝试做的事情来说是一种更容易(也更简单)的方法。

After looking at both approach, I decided the jqGrid was a far easier (and simpler) approach for what I was attempting to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文