Forum
16:43
10/08/2009
Hi Tony,
a very simple code
var gboxNode = jQuery("#list")[0].parentNode.parentNode.parentNode.parentNode;
jQuery(gboxNode).draggable ({handle:"div.ui-jqgrid-titlebar"});
makes jqGrid with id="list" draggable, so one can drag the grid on the header and drop it on another place on the web page. This small thing which came from stackoverflow.com can be interesting for other. What do you think about to add an additional parameter of jqGrid which do this?
Regards
Oleg
17:11
Moderators
30/10/2007
Hello,
Thanks. Good recomendation. But it is quite easy to do it so
var gboxNode = jQuery("#gbox_list")[0];
where gbox_list is the div where all the jqGrid things are - i.e combination from gbox_ + the id of the grid
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
17:55
10/08/2009
Hi Tony,
I save always the result of jQuery.jqGrid() in a variable, so the original code looks like
var grid = jQuery.jqGrid({...});
var gboxNode = grid.parentNode.parentNode.parentNode.parentNode;
jQuery(gboxNode).draggable ({handle:"div.ui-jqgrid-titlebar"});
and have no search operation like jQuery("#list"). If we use jQuery("#list"), the code jQuery("#gbox_list")[0] will be of cause quickly.
I know the way with "#gbox_list". I am not sure, but it seems to me that direct travailing 4 times for parentNode is more quickly as a global search in a page for an id. If the grid is already filled it could exist a lot of elements on the page having id attribute. I understand, that searching for ids is relatively quick way, but direct travailing seems to me more quickly. If we have more then one grids of the page, the work will be more complex.
After I read one time in the list of changes in some of jqGrid version about a fix, which makes jqGrid working if somebody use two times the same id on the same page, I found such problem very funny, but also very interesting. Since the time I prefer cache some jQuery objects in a local variables. Moreover I am looking for a programming style in JavaScript to improve code performance. I seen, that in the most places of jqGrid code you use searching for cells and other elements by ids. It seems to me that usage of travailing to parentNode from some known elements and more using of contexts in retrieving of elements could improve the performance of code. What do you think about this?
Best Regards
Oleg
Most Users Ever Online: 715
Currently Online:
95 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66