Forum

July 10th, 2011
You must be logged in to post Login Register

Search Forums:


 






3.7.1 tree grid slow to expand or collapse nodes

UserPost

17:43
16/06/2010


Les

Member

posts 44

Post edited 22:46 – 16/06/2010 by Les


I just upgraded from 3.6.5 to 3.7.1 and I see a big boo-boo. Cry


When you click a tree node it expands or collapses much slower compared to the previous release.


I see a large difference in IE7.  It feels really slugish.

13:22
17/06/2010


tony

Sofia, Bulgaria

Moderator

posts 7009

Hello,

Thanks for considering this. Also we make the tree grid in mind that this way it will be faster!?!

Since it is a very difficult to determine where the problem is, could you please send me a link to the problem,

so I can see what is happen.

Thank you


Best Regards

Tony

15:48
17/06/2010


Les

Member

posts 44

Tony,


I see that you made some code changes in the way tree grid row expand and collapse in 3.7.1.  I'm almost certain this is the cause of performance degradation.


The problem is easy to reproduce.  Just try to access the jqGrid demo application:


http://trirand.com/blog/jqgrid…..qgrid.html


Click for instance on "New in Version 3.5″.  The demo application is using 3.7.1 and you will see that the rows expand and collapse slowly with just 9 children.  This used to be fast in the previous 3.6.5 version.


Majority of my users use old Pentium laptops (Win XP and IE7), which I used for testing.


I you want I can upload a test application.  It's rather large but very easy to install.


09:29
20/06/2010


tony

Sofia, Bulgaria

Moderator

posts 7009

Hello,

I do not see such problem, or maybe my computer is not like your that you test.

Also I will try with more nodes.


Best Regards

Tony

18:03
20/06/2010


Les

Member

posts 44

Tony,


I did some more testing and I have measurements taken on another faster computer.


I inserted console.tiime and console.timeEnd in this click handler in 3.6.5 and 3.7.1 (Firefox 3.6.3 and Win XP)


$(".treeclick",row).bind("click",function(e){

See the results on pictures (3.7.1 is 10 times slower)


jqGrid 3.6.5

http://img191.imageshack.us/im…..ree365.png


jqGrid 3.7.1

http://img217.imageshack.us/im…../treew.png


I'd like to work with you to resolve this issue.  Please let me know what else I can do. 

04:08
21/06/2010


Les

Member

posts 44

Tony,


Performance of expandRow() and collapseRow() in 3.7.1 will improve if you remove the context, see below.


The context is not needed because the query (by ID) maps almost directly to document.getElementById.


collapseRow : function (record) {

//$("#"+id,$t.grid.bDiv).css("display","none");

$("#"+id).css("display","none");


expandRow: function (record){

//$("#"+id,$t.grid.bDiv).css("display","");

$("#"+id).css("display","");

04:48
21/06/2010


Les

Member

posts 44

The same change can be made in 3.7.1 in expandNode() and collapseNode() – don't provide context when the query is by id.


I made this change and now performance is the same as in 3.6.5.

05:00
21/06/2010


Les

Member

posts 44

I found post this which explains that passing a context will slow things down when query is an ID.

http://stackoverflow.com/quest…..th-context

10:06
25/06/2010


tony

Sofia, Bulgaria

Moderator

posts 7009

Hello,

First of all thank you very much for the investigations and recommendations.

I'm ready to do this, but imagine that you have two grids on the same page. It is quite possible thet both have same id,

in this case the collapsing and expanding maybe will not work, becouse it will depend which id will be find first.


Will see how to improve this.

Best Regards

and thanks again

Tony

15:47
25/06/2010


Les

Member

posts 44

Tony,


I just wanted to point out that by HTML spec element IDs must be unique in a document


http://www.w3.org/TR/html401/s…..ml#h-7.5.2


I'm painfully aware that the jqGrid will create elements with duplicate ids (not only in rows but also in column headers) when there are two grids populated with the same data.


I hope you realize that this is a really bad design.  Right now you have two problems: the markup is still bad and the grid is much less scalable because you added an inefficient piece of JavaScript to guard against the bad html.


I suggest instead of introducing new features, you concentrate on fixing the underlying architecture. 


Les

15:58
25/06/2010


tony

Sofia, Bulgaria

Moderator

posts 7009

Post edited 13:07 – 25/06/2010 by tony


Hello,

Thanks Les. Absolutley you are right, but if we fix this, nobody can continue to use the new versions – they should rewrite your code from the beginning.

For the column headers and other duplicate ids we can fix these, but the big questions is what to do with the rows ids?

Example: I have a table with primary keys 1,2,3.. and another table with the same primary keys numbering due of using the autoincremet property and I want to use these keys when I do CRUD operations.

In the same time I need to display both grids in one page – so the question is: how we can make these rows uniquie and in the same time to use the primary keys values?

Best Regards

Tony

16:10
25/06/2010


Les

Member

posts 44

Post edited 13:10 – 25/06/2010 by Les


Tony,


Perhaps you will need to make some tough decisions and brake backward compatibility in order to fix the markup.


Right now we are not able to upgrade to 3.7.1, and it's not because of the duplicate ids but because of the JS patch that you added to guard against the duplicate ids.


Les

16:38
25/06/2010


tony

Sofia, Bulgaria

Moderator

posts 7009

Hello Les,

The same will hapen if we do the change.

Instead I have begin a serious research on treeGrid and we will increase the speed .

Tony

11:39
19/10/2010


aurelien.pernoud

Member

posts 4

Hello tony,

did you by any chance have a look at optimizing treegrid (not only expandRow and collapseRow, but also loading) ?

I've tried 3.8 version with latest jQuery UI but except the expandRow and collapseRow that are indeed really slower (we used 3.6.4 before), loading is the same.

Thanks for your feedback.

Aurélien

05:24
27/10/2010


waiting

Member

posts 40

tony said:

For the column headers and other duplicate ids we can fix these, but the big questions is what to do with the rows ids?

Example: I have a table with primary keys 1,2,3.. and another table with the same primary keys numbering due of using the autoincremet property and I want to use these keys when I do CRUD operations.

In the same time I need to display both grids in one page – so the question is: how we can make these rows uniquie and in the same time to use the primary keys value


Hello Tony,

In my option, i should make it by this way:

use grid-container-id (eg. 'treegrid') as prefix of rows ids (eg. 'treegrid_1/treegrid_2/treegrid_3'). when CRUD then substr the prefix — this action can be done by client side before starting post, or by server side after receive the post data (must post the prefix  as individul key:value  togather)

waiting


About the jQuery Grid Plugin – jqGrid forum

Most Users Ever Online:

157


Currently Online:

61 Guests

Forum Stats:

Groups: 1

Forums: 7

Topics: 9595

Posts: 28789

Membership:

There are 10190 Members

There have been 448 Guests

There is 1 Admin

There are 2 Moderators

Top Posters:

OlegK – 1157

markw65 – 179

kobruleht – 144

phicarre – 126

YamilBracho – 124

Renso – 118

Administrators: admin (56 Posts)

Moderators: tony (7009 Posts), Rumen[Trirand] (81 Posts)




Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information