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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filter Remote Data

Thread ID:

Created:

Updated:

Platform:

Replies:

130016 Apr 15,2017 09:59 AM UTC Apr 17,2017 06:53 AM UTC ASP.NET MVC 1
loading
Tags: Grid
Andrias Abadi
Asked On April 15, 2017 09:59 AM UTC

Hi,

Im using the datagrid URL Adaptor as datasource, however following the example provided, it first retrieved ALL rows of data 

public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm)
        {
            IEnumerable Data = OrderRepository.GetAllRecords();            
            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations();
                       if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
            {
                Data = operation.PerformSorting(Data, dm.Sorted);
            }
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
            {
                Data = operation.PerformWhereFilter(Data, dm.Where, dm.Where[0].Operator);
            }
                 int count=Data.AsQueryable().Count();
            if (dm.Skip != 0)
            {
                Data = operation.PerformSkip(Data, dm.Skip);
            }
            if (dm.Take != 0)
            {
                Data = operation.PerformTake(Data, dm.Take);
            }
                   return Json(new { result = Data, count = count }, JsonRequestBehavior.AllowGet);
        }
I found this to be inefficient since when the data gets too large it takes seconds to retrieve the data
is there anyway to perform the data manipulation without having to retrieve the entire dataset?
I tried using IQueryable<T> as the data but this returns error

There is already an open DataReader associated with this Connection which must be closed first.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: MySql.Data.MySqlClient.MySqlException: There is already an open DataReader associated with this Connection which must be closed first.



Saravanan Arunachalam [Syncfusion]
Replied On April 17, 2017 06:53 AM UTC

Hi Andrias, 
Thanks for contacting Syncfusion’s support. 
We have analyzed your query, the UrlAdaptor returns data to the Grid control after perform the Grid operations such as paging, filtering and sorting. If we are not perform paging (Skip and Take), it will return all the records to the Grid from server. So, please ensure whether you have enabled the allowPaging on your project to perform ondemand paging and also ensure Skip and Take value on server after enable the paging. Please refer to the below code example, screenshot and online documentation link. 
@(Html.EJ().Grid<object>("FlatGrid") 
        .AllowPaging() 
            .Datasource(ds=> ds.URL("DataSource").Adaptor(AdaptorType.UrlAdaptor)) 
           . . . 
        ) 
 
 
We have also created a sample that can be downloaded from the below link, 
Regards, 
Saravanan A. 


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.

Warning Icon 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.Close Icon

;