This question is locked. New answers and comments are not allowed.
Stephan Parrot
Top achievements
Rank 1
Stephan Parrot
asked on 30 Mar 2010, 08:57 PM
Hi!
I'd like to know if there's a way or if it's planned on your side to provide more performance over large data sets for the Grid?
What I mean is, if I have 500K records in a table and want to have a paged grid displaying the content of this table, I have to load the entire 500K rows to have all the informations on how many pages there is, how many records, etc...
In other products, such as jqGrid and ext grid, we can use an extension named ToPagedList<T> so that we still have all the information about record and page counts without loading everything.
is there such support for this as of right now or you plan to bring such enhancements to your already VERY nice set of MVC controls?
Best regards,
Stephan
I'd like to know if there's a way or if it's planned on your side to provide more performance over large data sets for the Grid?
What I mean is, if I have 500K records in a table and want to have a paged grid displaying the content of this table, I have to load the entire 500K rows to have all the informations on how many pages there is, how many records, etc...
In other products, such as jqGrid and ext grid, we can use an extension named ToPagedList<T> so that we still have all the information about record and page counts without loading everything.
is there such support for this as of right now or you plan to bring such enhancements to your already VERY nice set of MVC controls?
Best regards,
Stephan
5 Answers, 1 is accepted
0
Stephan Parrot
Top achievements
Rank 1
answered on 30 Mar 2010, 09:01 PM
Ooops!! I just found out the "Total" property that I can use in CustomBinding scenarios that exactly does what I needed!
Thanks again for such a great line of products!!
We are investigating in MVC components suite that we will user for our new line of products and right now, Telerik seems the way to go!
:)
EDIT:
Scratch the above, I am not sure it can help me achieve what I was explaining at first.... I'll do some more research on this topic and meanwhile, if someone has a was of doing this, please share! ;)
Thanks again for such a great line of products!!
We are investigating in MVC components suite that we will user for our new line of products and right now, Telerik seems the way to go!
:)
EDIT:
Scratch the above, I am not sure it can help me achieve what I was explaining at first.... I'll do some more research on this topic and meanwhile, if someone has a was of doing this, please share! ;)
0
IQworks
Top achievements
Rank 1
answered on 31 Mar 2010, 07:43 AM
Hi Stephan,
Here is some MVC paging information ....
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-paging.html
Here is a paging demo ....
http://demos.telerik.com/aspnet-mvc-beta/grid/paging
And this one talks about reading large amounts of data in small chunks
http://www.telerik.com/products/aspnet-mvc/grid.aspx#paging
(not a lot, but a few google searches should give you more information about working with large amounts of data with MVC grids - it seems like a common concern )
For totals, I think you may want to search for "PagerItems".
Maybe this might help in your research if you have not seen it yet.
Here is some MVC paging information ....
http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-paging.html
Here is a paging demo ....
http://demos.telerik.com/aspnet-mvc-beta/grid/paging
And this one talks about reading large amounts of data in small chunks
http://www.telerik.com/products/aspnet-mvc/grid.aspx#paging
(not a lot, but a few google searches should give you more information about working with large amounts of data with MVC grids - it seems like a common concern )
For totals, I think you may want to search for "PagerItems".
Maybe this might help in your research if you have not seen it yet.
0
Stephan Parrot
Top achievements
Rank 1
answered on 31 Mar 2010, 01:29 PM
Thanks for the answer and the links IQworks!
I've solved my problems before I got your reply but I examined it and the links provided and I think my solution fits more the result I needed.
I still will give a try at home using Linq To SQL but here, at work, we use EntityFramework 4 and DataLoadOptions is use with Linq2Sql data models.
My solution was to be able to get the current page of the grid on each ajax request:
Then, in the DAL (I'm skipping the service layer as it's not really relevant for this):
[...]
I've solved my problems before I got your reply but I examined it and the links provided and I think my solution fits more the result I needed.
I still will give a try at home using Linq To SQL but here, at work, we use EntityFramework 4 and DataLoadOptions is use with Linq2Sql data models.
My solution was to be able to get the current page of the grid on each ajax request:
| public ActionResult Index(int? page) |
| { |
| //Sets the model for the view |
| var model = new CustomerModel { Customers = _service.GetCustomerList(page ?? 1), Total = _service.CustomerTotalCount }; |
| return View(model); |
| } |
| [GridAction(EnableCustomBinding=true)] |
| public ActionResult _Index(int page) |
| { |
| return View(new GridModel { Data = _service.GetCustomerList(page), Total = _service.CustomerTotalCount }); |
| } |
Then, in the DAL (I'm skipping the service layer as it's not really relevant for this):
[...]
| public IEnumerable<CustomerEntity> GetCustomerList(int pageNum) |
| { |
| var data = _entities.Customer.OrderBy(c => c.ID).Skip(5 * pageNum).Take(5); |
[...]
Finally, my grid is configured to bind with data as follow:
| <% Html.Telerik().Grid<CustomerEntity>(Model.Customers) |
| .Name("Customer") |
| .DataKeys(keys => |
| keys.Add(o => o.ID).RouteKey("Id") |
| ) |
| .DataBinding( |
| dataBinding => |
| { |
| [...] |
| } |
| ) |
| .Columns( |
| columns => |
| { |
| [...] |
| } |
| ) |
| .Pageable((paging) => |
| paging.Enabled((bool)ViewData["paging"]) |
| .PageSize(Model.PageCount).Total(Model.Total) |
| .Style(GridPagerStyles.Status | GridPagerStyles.NextPreviousAndInput) |
| .Position(GridPagerPosition.Both)) |
| .EnableCustomBinding(true) |
| .Render(); |
| %> |
Done this way, I have loaded my Database with 1 000 000 records and it loads VERY fast in the browser and each next page and previous is as fast no matter where I am in the paging of the grid!
As I said, the Telerik MVC components are way better than any other ones I've worked with or tried so far!
Hope this helps someone!
Thanks,
Stephan
0
IQworks
Top achievements
Rank 1
answered on 31 Mar 2010, 04:45 PM
Hi Stephan,
Thats great !
i will take note of your solution for myself because I also use EF in my projects.
thanks
Thats great !
i will take note of your solution for myself because I also use EF in my projects.
thanks
0
Stephan Parrot
Top achievements
Rank 1
answered on 31 Mar 2010, 07:42 PM
My pleasure!
:)
:)