0

Kendo grid is too slow when grouping. My first grouping took one minute approximately and second grouping not working. when I made second grouping,I got maxjsonlength error. How can I faster kendo grid grouping on big data? My grid is clasic grid code without paging and virtual paging in mvc. and my data is select * from mytable. Data count is 2800. here is the code;

     @(Html.Kendo().Grid<DoktorModel>()
              .Name("DoktorGrid")
              //.HtmlAttributes(new { style = "height: 600px;" })
              .Columns(columns =>
              {
                  columns.Bound(p => p.Fotograf).ClientTemplate(@"<img class='doktor_photo' src='" + Url.Content("~/Photo/#:data.Fotograf#") + "'/>").Width(100).Title("Fotoğraf").Filterable(false).IncludeInMenu(false);
                  columns.Bound(p => p.Ad).Width(200).ClientGroupHeaderTemplate("Ad: #= value # (Sayı: #= count#)");
                  columns.Bound(p => p.Soyad).Width(200);
                  columns.Bound(p => p.DogumTarihi).Format("{0:dd/MM/yyyy}").Width(150);

           ...   

              })   
              .ToolBar(X => X.Template(@<text>
                <div class="toolbar">
                    <div>
                        <a class="k-button k-button-icontext k-grid-excel" href="\#"><span class="k-icon k-i-excel"></span>Export to Excel</a>

                        <a class="k-button" id="GrupAc"><span class="k-icon k-i-close"></span>Grupları Aç</a>
                        <a class="k-button" id="GrupKapat"><span class="k-icon k-i-close"></span>Grupları Kapat</a>
                        <div id="menu"></div>
                    </div>
                </div>

            </text>))



                      .Resizable(x => x.Columns(true))


                      .Selectable()
                      .Sortable()
                      .Scrollable(scrollable => scrollable.Virtual(true))
                       .Excel(excel => excel
                       .FileName("Kendo UI Grid Export.xlsx")

                       .AllPages(true)
                       .ProxyURL(Url.Action("Doktor_Excel_Export_Save", "Doktor"))
                         )
                        .Filterable(filterable => filterable
                              .Extra(false)
                              .Operators(operators => operators
                               .ForString(str => str.Clear()
                               .Contains("İçerir")

                          )).Mode(GridFilterMode.Menu))
                          .Groupable()
                          .Events(events => events.DataBound("datachange")
        )
                      .DataSource(dataSource => dataSource
                          .Ajax()


                          //.Batch(false)
                          .Events(e => e.Error("error_handler"))
                          .Read(read => read.Action("Doktor_Read", "Doktor").Type(HttpVerbs.Post))

                            .Aggregates(aggregates =>
                            {
                                aggregates.Add(p => p.AkademikUnvanKodId).Count();
...
                            })
                          .Model(m =>
                          {
                              m.Id(p => p.DoktorId);
                              m.Field(p => p.TCKimlikNo);
                             ...
                          })))

And my controller code;

[HttpPost]
    public JsonResult Doktor_Read([DataSourceRequest] DataSourceRequest request)
    {
        var result = Business.Doktor.GetDoktorList().ToDataSourceResult(request);
        return Json(result, JsonRequestBehavior.AllowGet);
    }
}

AND ERROR İS;

Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.

user3452425
  • 73
  • 2
  • 10
  • I max my grid out at 1000 records when client aggregation is supported. Paging and grouping don't mix, however, it is no secret that the browser is not the best place to aggregate large chunks of data. I would think of a way to reduce the results set for the grid or shy away from some of the aggregate functions. 2800 records is supported and will work client side, however, do not look for screaming performance here either. – Ross Bush Oct 27 '16 at 12:52
  • Why can't you use paging? Because you're going to need to use paging. It is unavoidable with any non-trivial amount of data. But if you must, you can increase the maxJsonLength: http://stackoverflow.com/a/13961055/4825632 – The Dread Pirate Stephen Oct 27 '16 at 12:55
  • Paging and grouping can be mixed, but if you do so, you need to ensure that the data returned from the controller is sorted according to the grouping order, otherwise it will not be paged correctly. The request object received in the controller action contains the client's grouping configuration. – NigelK Oct 27 '16 at 17:53
  • With regard to the MaxJsonLength error, see http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/troubleshoot/troubleshooting#json-javascriptserializer-serialization-or-deserialization-error – dimodi Oct 27 '16 at 20:36

0 Answers0