当两个网格位于同一页面时排序
在我的页面上有两个 webGrid。当我单击一个网格对该列进行排序时,两个网格都会在该列上排序。对仅在一个列中进行排序根本不会排序。
我注意到排序的工作原理是使标题成为同一页面的链接,并在查询字符串中包含一列和一个方向。这说明两个网格都受到影响。我想知道 webGrid 是否有一些功能可以解决我的问题,或者我应该自己修复它。
我计划“自己修复它”的方法是首先通过设置 htmlAttributes 向表标签添加 id 属性。然后我将使用 jQuery 为每个 webgrid 查找此 id 并将该 id 合并到链接参数中。然后,当加载带有网格的页面时,我将根据这些参数强制设置要排序的列。
在我看来,webGrid 并不是设计为与另一个 webGrid 位于同一页面上的。然而,我觉得在我的情况下这是需要的。我更喜欢使用某种标准方式(内置或只是其他人使用的方式)。
所以问题是,最好的方法是什么?如果没有最好的方法,我的方法是不是一个好方法(我是否忘记了什么)?
提前致谢。
On my page I have two webGrids. When I click on one to sort that column, both of the grids are sorted on that column. Sorting on a column that is only in one, doesn't sort at all.
I noticed the sorting works by making the header a link to the same page with in the query string a column and a direction. This explains that both grids are affected. I was wondering if the webGrid has some functionality to solve my problem or should I fix it myself.
The way I am planning to "fix it myself" is to first add an id attributes to the table tags by setting the htmlAttributes. Then I will use jQuery to find this id for every webgrid and incorporate that id in the links parameters. Then when loading a page with a grid I will forcably set which column to sort on based on those parameters.
It seems to me the webGrid is not designed to be on a page with another webGrid. However, I feel that in my situation it is desired. I prefer to use some standard way (built in or just what everyone else uses).
So the question is, what is the best way to do it? And if there is no best way, is my way a good way (did I forget about something)?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您需要设置以下属性:
I think you need to set the following properties: