I just upgraded from 3.6.5 to 3.7.1 and I see a big boo-boo. 
When you click a tree node it expands or collapses much slower compared to the previous release.
I see a large difference in IE7.
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
Tony,
I see that you made some code changes in the way tree grid row expand and collapse in 3.7.1.
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
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/img191/9291/tree365.png
jqGrid 3.7.1
http://img217.imageshack.us/img217/7056/treew.png
I'd like to work with you to resolve this issue.
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”,””);
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.
I found post this which explains that passing a context will slow things down when query is an ID.
http://stackoverflow.com/questions/2421782/preformance-of-jquery-selector-with-context
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
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/struct/global.html#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.
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
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
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
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
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
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top