This is a migrated thread and some comments may be shown as answers.

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

2 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
martin
Top achievements
Rank 1
martin asked on 14 Nov 2012, 03:32 PM
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 Answers, 1 is accepted

Sort by
0
Samuel
Top achievements
Rank 2
answered on 18 Nov 2012, 08:42 PM
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;
}
0
martin
Top achievements
Rank 1
answered on 28 Nov 2012, 09:56 AM
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
Tags
Grid
Asked by
martin
Top achievements
Rank 1
Answers by
Samuel
Top achievements
Rank 2
martin
Top achievements
Rank 1
Share this question
or