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

Setting pageSize when initializing from HTML

5 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 10 Mar 2014, 11:01 PM
Is there a way to set the default pageSize on the dataSource for a grid when initializing from HTML? I'm using mostly the JavaScript widgets (hence posting in the web forum), but I also have licensed access to the JSP wrappers. I just have not gotten any experience or knowledge using the kendo taglib yet.

Goal: Increase performance.

Background: due to some legacy code, I have to initialize the grid from an HTML table. Most of the time it works just fine, but sometimes this page will have a large amount of data (thousand of rows), and so the grid is very slow, or locks up.

Documentation has suggested using virtual scrolling, and while setting the virtual scroll option on the widget "works" when initializing from HTML, it's still very slow. I see no noticeable difference in performance. My thought is that this could be because I'm not setting a pageSize on the dataSource. It would need to be done (I think) before initializing the grid, otherwise the page will still be very slow to load and could still lock up; I don't see how I can do that.

Is there a way to do this with the JSP wrappers/taglib? Or is there something I'm missing in the JavaScript side of things?

5 Answers, 1 is accepted

Sort by
0
Keith
Top achievements
Rank 1
answered on 10 Mar 2014, 11:25 PM
I've tried something like the following:

01.$("#myTable").kendoGrid({
02.     
03.        dataSource:{
04.          pageSize:50
05.        },
06.        scrollable:{
07.          virtual:true
08.        },
09.        height: 430,
10.        sortable: true,
11.        selectable: "cell",
12.        navigatable:true,
13.        resizable: true,
14.        reorderable: true,
15.        columnResizeHandleWidth: 10
16.    });


The grid still initializes, but I don't see any improvement. I'm not sure if it's just ignoring the dataSource configuration or not?
0
Accepted
Kiril Nikolov
Telerik team
answered on 12 Mar 2014, 03:37 PM
Hi Keith,

The pageSize configuration is taken into account when you set it on the dataSource of the grid. However rendering the big HTML table and then converting it to a grid is a resource consuming task and the initial loading will still be slow. 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Keith
Top achievements
Rank 1
answered on 12 Mar 2014, 06:36 PM
Thanks for your answer. Understanding what is going on helped me to optimize the loading and performance.

Setting the pageSize to 10 improved performance. Even better performance is gained by just using the pageable options and configuration. Either way the load time is the same, but it doesn't freeze when using pageable configurations with a reasonable page size.

Old machines will never getting younger.

0
Accepted
Kiril Nikolov
Telerik team
answered on 13 Mar 2014, 08:30 AM
Hi Keith,

The load time stays the same as you still render the initial HTML page, which is a DOM heavy process. I would suggest you to think about generating a JSON response that you can bind directly to the grid and not use the HTML table at first, this will definitely speed up your project and as you said - old machines will never get younger.

I wish you a great day and in case you have any further questions, please do not hesitate to contact us.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Keith
Top achievements
Rank 1
answered on 13 Mar 2014, 01:03 PM
I've put in that suggestion. Now we just need some hour$ to do it.

Thanks,

Keith
Tags
Grid
Asked by
Keith
Top achievements
Rank 1
Answers by
Keith
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or