问题描述
我使用的是Telerik的网格显示数据到客户端。我必须首先显示优先级值,然后显示非优先级。当优先级的用户群基础,优先级值应组首先由非优先级组跟进。我有一个默认的下行分组。当用户第一次访问该页面,它工作正常。然而,如果用户删除默认分组和尝试在再次柱,所述非优先值被优先这是我想要的相反以下第一组中所示基团。
I am using a Telerik Grid to display data to the client. I have to show priority values first and then display non priority values. When the user group base on priority, the priority values should group first follow by the non priority group. I have a default descending grouping. When the user first access the page, it works fine. However, if the user remove the default grouping and try to group that column again, the non priority values are shown in the first group following by the priority which is the opposite of what I want.
另外,我试图做它使用jQuery的客户端,但网格变量始终返回null。
In addition, I tried to do it on the client side using jquery, but the grid variable is always return null.
$(function () {
var grid = $('#Shipping').data('tGrid);
alert(grid) // always return null.
});
下面是客户端code,我使用了该列。
Here is the client side code that I am using for that column.
@(Html.Telerik().Grid(Model)
.Name("Shipping")
.DataKeys(Keys =>
{
Keys.Add(c => c.ShippingID);
})
.DataBinding(databinding => databinding.Server())
.Columns(columns =>
{
columns.Bound(p => p.Priority)
.Title("Priority")
.HtmlAttributes(new { style = "text-align:left" })
.Width(50)
.Filterable(false)
.Sortable(true)
.Groupable(true) // I can't tell it group and sort it descending.
.GroupHeaderTemplate(@<text>
.Groupable(grouping => grouping.Groups(gr =>
{
//Here I can tell it that I want to sort it descending
gr.Add("Priority", typeof(Boolean), System.ComponentModel.ListSortDirection.Descending);
}))
请帮助我或者给我就如何解决这一问题的暗示?
Please help me or give me a hint on how to fix this issue?
推荐答案
添加客户端事件固定的问题,这就是为什么网格总是显示jQuery函数空值的原因。该分组仍是个问题;然而,客户端同意他们可以点击的排序按钮,它将它们正确排序。
Adding a client side event fixed the issue, it was the reason why the grid was always showing null value in the JQuery function. The Grouping is still an issue; however, the client agree that they could click on the sort button, and it will sort them properly.
这篇关于Telerik的重新排序列分组后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!