Forum
01:59
16/12/2009
Hi,
In debuging issues I was having with sorting table, I had to make some code changes. Here is a list of what I had to modify in grid.base.js:
- grid.headers[k] is undefined in the loop in two places. I had to place a null / undefined check:
- Line 899: $(this).css("width",grid.headers[k].width+"px");
- Line 1576: $(this).css("width",self.grid.headers[k].width+"px");
- Appending sorted row to grid was causing my Firefox to freeze, chew up tons of memory and report unruly script. The problem was happening on line 910: $('tbody',ts.grid.bDiv).append(row);. Since I am not very good with Javascript, I fixed this issue by changing line 903 onwards. Changes are as follows:
- Previously:
var cn = "";
if(ts.p.altRows) cn = ts.p.altclass;
$.each(rows, function(i, row) {
if(cn) {
if(i%2 ==1) $(row).addClass(cn);
else $(row).removeClass(cn);
}
$('tbody',ts.grid.bDiv).append(row); <--- This line was causing freeze
row.sortKey = null;
}); - Now:
var cn = "";
// Raj change
var sRowsText = "";
// End Raj change
if(ts.p.altRows) cn = ts.p.altclass;
$.each(rows, function(i, row) {
if(cn) {
if(i%2 ==1) $(row).addClass(cn);
else $(row).removeClass(cn);
}
// Raj change: Comment out the append
//$('tbody',ts.grid.bDiv).append(row);
var jRow = $( row );
sRowsText = sRowsText + "<tr id='" + jRow.attr( "id" ) + "' class='" + jRow.attr( "class" ) + "' role='" + jRow.attr( "role" ) + "'>" + jRow.html() + "</tr>";
// End Raj change
row.sortKey = null;
});
// Raj change: Clear out displayed rows and append rows to inside of table
var dataTable = $('table',ts.grid.bDiv);
dataTable.children().remove();
dataTable.html( sRowsText );
// End Raj change
- Previously:
I hope this is useful.
-Raj
15:04
Moderators
30/10/2007
Hello,
Thanks for these investigations, but you are the only to this moment that reported this behaviour.
IMHO there is something else - and I think that this is coused by the data provided from you.
In order to izolate the problem I suggest you to test your application only with jqGrid removing any other plugins
and js files that are not needed.
Instead I will not do this change.
Thank you
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.
Most Users Ever Online: 715
Currently Online:
103 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