- Home
- Forum
- ASP.NET MVC
- Cargar miles de registros en Grid
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.
SIGN IN To post a reply.
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.
Regards,
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:
View():
.Datasource(ds => ds.URL("/Controller/DataSource").Adaptor(AdaptorType.UrlAdaptor))
Controller():
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:
|
@(Html.EJ().Grid<object>("Grid")
.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.
Regards,
Prasanna Kumar N.S.V
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
CV César Ventura
- Dec 5, 2016 07:11 PM UTC
- Dec 8, 2016 09:34 AM UTC