views:

53

answers:

0

Hi, i m using telerik extensions for .net mvc. in grid everything is working fine until i try to group the grid control based on some columns. actually my grid is not server bound (even it loads the grid from a partial view using ajax). in this grid grouping causes problems and i get javascript error at a[this.plugins[e]].initialize(this) in grid.min.js. following link outlines two methods for ajaxically loading telerik grid http://www.telerik.com/help/aspnet-mvc/using-with-partial-views-loaded-via-ajax.html

i m using first method i.e Partial Views via the built-in ASP.NET MVC Ajax support not the jquery one

i m interested in how i can make grouping work in this scenario. all my grid controls are working fine with grouping if they only receive data through ajax (not grid control)

<% Html.Telerik().Grid<UserManagement.Models.SentMemos>()
.Name("ReceivedMemos")
.Sortable(sorting => sorting
.OrderBy(sortOrder => sortOrder.Add(o => o.SortType).Ascending()))
.DataBinding(dataBinding => dataBinding
//Ajax binding
.Ajax()
//The action method which will return JSON
.Select("_AjaxBindingReceivedMemos", "OA")

).
Columns(colums =>
{
colums.Bound(o => o.Link).Encoded(false).Filterable(false).Title(" ").Width(50);
colums.Bound(o => o.FromEmployeeName).Title("From").Width(200).HtmlAttributes(new { @class = "ihover ReceivedMemos" });
//colums.Bound(o => o.MemoID).ClientTemplate(Html.ActionLink("Reply", "ReplyMemo", "OA", new {id = 12, MemoID = "<#=MemoID#>" }, null).ToString()).Title("Reply").Filterable(false).Sortable(false).HtmlAttributes(new { @class = "ihover ReceivedMemos" });
colums.Bound(o => o.Subject);//.ClientTemplate("<a href=\"/OA.mvc/PreviewMemo/" + "<#=MemoID#>" + "\">" + "<#=Subject#>" + "</a>").Encoded(false).Title("Subject").HtmlAttributes(new { @class = "ihover ReceivedMemos" });
colums.Bound(o => o.MemoDate).Title("Date").Width(150).HtmlAttributes(new { @class = "ihover ReceivedMemos" });

})


.Groupable(grouping => grouping.Groups(g =>
{
g.Add(c => c.SortType);
}))
.Sortable()
.Filterable()
.RowAction((row) =>
{
row.HtmlAttributes.Add("style", "height:31px;");
})
.Pageable(pager => pager.PageSize(20))
.PrefixUrlParameters(false)
.ClientEvents(events => events.OnRowDataBound("onRowDataBound"))
.Render();

%>