Is there a way to control the order of the grouping in a Kendo UI grid. There is a group I would like to go before all other groups, but it seems Kendo UI grid sorts the groups alphabetically. I know that adding a space to the grouping name works but that's seems very hackish.

有没有办法控制Kendo UI网格中的分组顺序。我希望在所有其他组之前有一个小组,但似乎Kendo UI网格按字母顺序对组进行排序。我知道为分组名称添加一个空间可以工作,但这似乎非常hackish。

Thanks Leo

谢谢狮子座

7 个解决方案

#1


5

There is currently no way to sort a grouping on something other than the group's field. Having a way to sort groups like Telerik does in their non-Kendo grids is my biggest feature request for them right now. So we are stuck using hacks for now.

目前无法对群组字段以外的其他内容进行分组。有一种方法可以像Telerik那样对他们的非Kendo网格进行排序,这是我现在最大的功能要求。所以我们现在一直在使用黑客。

One hack that works for me is to combine the sorting field and the display field into a new string column that hides the sorting field portion inside a hidden span. This is done on the data source side (for me, in SQL). The new column is then sorted as a string even if the sorting field was a number, so you have to pad appropriately in some cases.

对我有用的一个方法是将排序字段和显示字段组合到一个新的字符串列中,该字符串将隐藏范围内的排序字段部分隐藏起来。这是在数据源端完成的(对我来说,在SQL中)。然后,即使排序字段是数字,新列也会被排序为字符串,因此在某些情况下您必须适当填充。

For example, if my data was:

例如,如果我的数据是:

[ 
    { 
      'Name': 'Alice', 
      'Rank': 10, 
      'RankName': '<span class="myHiddenClass">10</span>Alice', 
      ... (other fields)
    },  
    { 
      'Name': 'Bob', 
      'Rank': 9, 
      'RankName': '<span class="myHiddenClass">09</span>Bob', 
      ... (other fields)
    },  
    { 
      'Name': 'Eve', 
      'Rank': 11, 
      'RankName': '<span class="myHiddenClass">11</span>Eve', 
      ... (other fields)
    } 
    ... (Multiple Alice / Bob / Eve records)
]

Then I can group by the RankName field instead of the Name field. It will display the Name field in the group header but be sorted by the Rank field. In this case, Bob will show up as the first group even though Alice was first alphabetically. This works similarly to the space padding you mentioned.

然后我可以按RankName字段而不是Name字段进行分组。它将在组标题中显示“名称”字段,但按“排名”字段排序。在这种情况下,即使Alice按字母顺序排列,Bob也会显示为第一组。这类似于您提到的空间填充。

更多相关文章

  1. 使用表单字段值定制CSS属性。
  2. 如何在HTML主体上设置网格ExtJS,高度为100%
  3. 我无法在某些Web浏览器中输入我的注册文本字段
  4. 将文本从表单复制到另一个网站的文本字段
  5. 如何定义两个日期之间的Kendo网格列过滤器?
  6. 我正在尝试使用带有post方法的AJAX将用户名和密码发送到php文件
  7. 仅使用CSS的输入字段的一部分
  8. 如何使用struts2访问表单数组字段
  9. PHP选择具有特定宽度的图像并构建网格

随机推荐

  1. 高仿android微信源码下载
  2. 2011.08.12(2)——— android MediaPlayer
  3. Android 获取通讯录信息
  4. 探索Android该Parcel机制(上)
  5. 在下方的tab页
  6. android BadTokenException之token is no
  7. android 内存清理
  8. android截屏代码:C++实现
  9. GoogleAndroid常用的Android常量
  10. 读取raw文件下文件内容