how to refresh a huge grid if only few data have been changed

3 posts, 0 answers
  1. martin
    martin avatar
    10 posts
    Member since:
    Oct 2012

    Posted 14 Nov 2012 Link to this post

    Hi everybody, 

    I am working on a grid which contains a lot of data (like 100 000 rows). I was wondering how I could refresh it in case of some data would be changed in the dataSource without reload the entire grid.

    Is it possible? I have been searching for the answer in the documentation and other posts but have not found anything!

    I really need to figure it out asap!! 
    any answer would be much appreciated
    Thank you very much
  2. Samuel
    Samuel avatar
    19 posts
    Member since:
    Aug 2012

    Posted 18 Nov 2012 Link to this post

    I'm assuming you're already using paging on your results? You might try caching the results then refreshing only those rows that don't have cached results. In the MVC Example, they do this inside their repository for the orders, but if it needed to be a more granular cache I think you would be able to simply modify the example as needed. I use HttpContext.Session for items that could be different per user and .Cache for application-wide items that can be stored on the server. Hope this helps!

    SessionClientOrderRepository.cs:
    public static IEnumerable<ClientOrderViewModel> All()
    {
        IEnumerable<ClientOrderViewModel> result = HttpContext.Current.Session["orders"] as IEnumerable<ClientOrderViewModel>;
     
        if (result == null)
        {
            HttpContext.Current.Session["orders"] = result = new NorthwindDataContext().Orders
                .Select(o => new ClientOrderViewModel
                {
                    OrderID = o.OrderID,
                    OrderDate = o.OrderDate ?? DateTime.Now,
                    ShipAddress = o.ShipAddress,
                    ShipCountry = o.ShipCountry,
                    ShipName = o.ShipName,
                    ContactName = o.Customer.CompanyName,
                    EmployeeID = o.EmployeeID ?? 0,
                    Employee = new ClientEmployeeViewModel {
                        EmployeeName = o.Employee.FirstName + " " + o.Employee.LastName,
                        EmployeeID = o.EmployeeID ?? 0
                    }
                }).ToList();
        }
     
        return result;
    }
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. martin
    martin avatar
    10 posts
    Member since:
    Oct 2012

    Posted 28 Nov 2012 Link to this post

    Hi Samuel, 

    sorry for the late answer
    I have been searching for a while and the only solution I have found (except yours) is to use the dataSource.read() followed by the grid.refresh().
    So I will try it, see which result is bringing out!
    But before I am fighting with another issue, the asynchronous load of data to update the grid!

    Thank you anyway
    Cheers
Back to Top