2012-04-02 69 views
2

我使用的是telerik grid for mvc with ajax custom binding,它的運行正常,但問題是當我應用它發送的分組時,會將網格廢棄。MVC Grid自定義綁定(Ajax)GroupBy問題

之前分組

enter image description here

分組

enter image description here

客戶端代碼後看起來像

colums.Bound(o => o.TO).Title("To").Groupable(false).HtmlAttributes(new { style = "text-align:center" }).Width(150); 
       colums.Bound(o => o.CanChange).Hidden(true); 
       colums.Bound(o => o.PlanHospitalID).Hidden(true).HtmlAttributes(new { @class = "planhospital" }); 
       if ((Model.GeoLocationType == SalesEnum.Region.ToString())) 
       { 
        colums.Bound(o => o.RMAcompanies).Groupable(false).Title("Join(RM)").ClientTemplate("<input class='rmjoin' name='RMID' type='checkbox' value='" + Model.DesignationID + "' <#=RMAcompanies? checked='checked' : '' #> <#=CanChange? '' : disabled='disabled' #> /><input type='hidden' name='PlanHospitalID' value='<#= PlanHospitalID#>'/>"); 
       } 
       colums.Bound(o => o.SMCanChange).Hidden(true); 
       if (Model.GeoLocationType == SalesEnum.Zone.ToString()) 
       { 
        colums.Bound(o => o.SMAcompanies).Title("Join(SM)").Groupable(false).ClientTemplate("<input class='smjoin' type='checkbox' name='SMID' value='" + Model.DesignationID + "' <#= SMAcompanies?checked='checked':'' #> <#=SMCanChange? '' : disabled='disabled' #> /><input type='hidden' name='PlanHospitalID' value='<#=PlanHospitalID#>'/>"); 
       } 
       colums.Bound(o => o.Participants).Groupable(false); 
+0

您是否在控制器中實施了分組?在線演示顯示需要完成的工作。 – 2012-04-13 08:42:51

+0

@AtanasKorchev是的,我已經在服務器端實現了分組。 – 2012-04-14 11:23:52

+1

它看起來好像組沒有序列化。向我們展示控制器的外觀。 – 2012-04-14 16:09:15

回答

1

我HAVA一直在煩惱了好幾天。 我現在得到了原因...

對於ajax控制器,您必須: 1 - 檢索併發回所有數據,不僅僅是pagesize; 2 - 返回視圖(模型)而不是json格式。

希望它能幫助你。

+0

tnx花時間回答一個老問題,我會檢查出來... – 2013-04-17 19:26:14