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.
Unfortunately, activation email could not send to your email. Please try again.

Cargar miles de registros en Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

127730 Dec 5,2016 02:11 PM Dec 8,2016 04:34 AM ASP.NET MVC 3
loading
Tags: Grid
César Ventura
Asked On December 5, 2016 02:11 PM

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.

Ragavee U S [Syncfusion]
Replied On December 6, 2016 01:48 AM

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. 


César Ventura
Replied On December 6, 2016 12:11 PM

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.

Prasanna Kumar Viswanathan [Syncfusion]
Replied On December 8, 2016 04:34 AM

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 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;