We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cargar miles de registros en Grid

Buen día,
Quiero cargar miles de registros en un Grid, pero es muy lenta la visualización de los datos al cargar la página y en ocasiones produce errores de "maxJsonLength",
quiero saber como cargar la información conforme en usuario la requiera y no se carguen todos los datos al cargar la página.
He intentado con la propiedad .allowPagin() y .pageSize() pero no funciona.

de antemano muchas gracias.

3 Replies

RU Ragavee U S Syncfusion Team December 6, 2016 06:48 AM UTC

Hi Cesar, 

Query #1: Error during serialization or deserialization using the JSON JavaScriptSerializer 

This exception is obtained while exceeding the maxJson length while performing serialization or deserialization. We have used the default MaxJsonLength value (2097152 characters, which is equivalent to 4 MB of Unicode string data) of the JavaScriptSerializer which is a fixed universal standard length for serializing the data.  

We have already discussed on this topic in the following knowledge base document.    

Query #2: Fetch data page by page. 

We understand that your requirement is to fetch data on demand. We can achieve this using the data manager and the data adaptors. We have created a grid sample using UrlAdaptor which can be downloaded from the below location.  

DataManager is used to manage relational data. It also queries the data based on user’s request and provide the desired data. Please refer to the below online documentation for more information  

When using UrlAdaptor, we need to handle the data operations at server side. Please refer to the below document to understand better on the query parameters and data operations at server side.  

Ragavee U S. 

CV César Ventura December 6, 2016 05:11 PM UTC

Gracias por su pronta respuesta, he implementado el URL Adaptor de esta manera:


.Datasource(ds => ds.URL("/Controller/DataSource").Adaptor(AdaptorType.UrlAdaptor))


public ActionResult DataSource(DataManager dm)
            var DataSource = (from pos in db.BID_POS
                              select pos);

            DataResult result = new DataResult();
            result.result = DataSource.OrderByDescending(p => p.b_pos_id).Skip(dm.Skip).Take(dm.Take).ToList();
            result.count = DataSource.Count();
            return Json(result, JsonRequestBehavior.AllowGet);

y todo bien, solo que al querer visualizar la información me marca error de Javascript:

Uncaught TypeError: Cannot read property 'length' of undefined

en el  script ej.web.all.min.js

Como podría solucionarlo?

muchas gracias.

PK Prasanna Kumar Viswanathan Syncfusion Team December 8, 2016 09:34 AM UTC

Hi Cesar, 

Query : “Uncaught TypeError: Cannot read property 'length' of undefined” 

We checked in our sample with the given code example and we unable to reproduce the mentioned issue at our end.  

Find the code example and sample:  

            .Datasource(d => d.URL("/Home/GetData").Adaptor(AdaptorType.UrlAdaptor)) 

public ActionResult GetData(DataManager dm) 
            var DataSource = OrderRepository.GetAllRecords(); 
            DataResult result = new DataResult(); 
            result.result = DataSource.OrderByDescending(p => p.EmployeeID).Skip(dm.Skip).Take(dm.Take).ToList(); 
            result.count = DataSource.Count(); 
            return Json(result, JsonRequestBehavior.AllowGet);          

To reproduce the mentioned issue, we need the following details 

1. Code example of a Grid.  

2. Share the stackrace of an issue.  

3. Essential Studio Version details. 

4.  Please ensure whether you have some records in result.result property at server-side GetData method. 

5. If possible, replicate the issue in the attached sample.  

Prasanna Kumar N.S.V 

Live Chat Icon For mobile
Up arrow icon