Forum
17:47
17/04/2012
Hi!
I had issue with Firefox 11 and resizing columns, for a few hours I got a solution for this issue. A part of the core code has to be improved, this is my solution:
this.hDiv.style.cursor =
"default";
if (this.resizing) {
var e = this.resizing.idx,f = this.headers[e].newWidth || this.headers[e].width;
f = parseInt(f, 10);
this.resizing = false;
b("#rs_m" + b.jgrid.jqID(c.id)).css("display", "none");
c.colModel[e].width = f;
this.headers[e].width = f;
this.headers[e].el.style.width = f + "px";
this.cols[e].style.width = f + "px";
if (this.footers.length > 0)this.footers[e].style.width = f + "px";
if (c.forceFit === true) {
jQuery('#' + c.id).css("display", "table");
var bDivElement = jQuery(this.bDiv);
var bDivElementHeight = this.bDiv.clientHeight + "px";
bDivElement.css("height",bDivElementHeight);
this.cols[e + c.nv].style.height = "0";
f = this.headers[e + c.nv].newWidth || this.headers[e + c.nv].width;
c.colModel[e + c.nv].width = f;
this.headers[e + c.nv].width = f;
this.headers[e + c.nv].el.style.width = f + "px";
this.cols[e + c.nv].style.width = f + "px";
if (this.footers.length > 0)this.footers[e + c.nv].style.width = f + "px";
jQuery('#' + c.id).css("display", "none");
setTimeout(function() {
bDivElement.css("height",c.height);
jQuery('#' + c.id).css("display", "table");
}, 50);
} else {
c.tblwidth = this.newWidth || c.tblwidth;
b("table:first", this.bDiv).css("width", c.tblwidth + "px");
b("table:first", this.hDiv).css("width", c.tblwidth + "px");
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
if (c.footerrow) {
b("table:first", this.sDiv).css("width", c.tblwidth + "px");
this.sDiv.scrollLeft = this.bDiv.scrollLeft
}
}
b.isFunction(c.resizeStop) && c.resizeStop.call(this, f, e)
}
this.curGbox =
null;
document.onselectstart = function() {
return true
}
}
A part of the code whic is improved is inside this case "c.forceFit === true". The table element has to be hidden and shown after resize is finished. Also div element height property can be set to some value in pixels or by default set to "auto", we don't know that, because each time table is hidden/shown code gets current value of height property and set it after table is shown.
If any one has better solution about this issue, please, reply on this topic. Thanx!!!
12:34
Moderators
30/10/2007
Hello,
Thank anyway for the issue.
Could you please use the source code and make the changes clear so that we can see really the problem.
Regards
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.
12:50
17/04/2012
Hi Tony,
posted code snippet is just a part of the jqgrid source code i will try now to clear out what is changed
dragEnd:function() {
this.hDiv.style.cursor =
"default";
if (this.resizing) {
var e = this.resizing.idx,f = this.headers[e].newWidth || this.headers[e].width;
f = parseInt(f, 10);
this.resizing = false;
b("#rs_m" + b.jgrid.jqID(c.id)).css("display", "none");
c.colModel[e].width = f;
this.headers[e].width = f;
this.headers[e].el.style.width = f + "px";
this.cols[e].style.width = f + "px";
if (this.footers.length > 0)this.footers[e].style.width = f + "px";
if (c.forceFit === true) {
// This line is added, table element gets display property set as table
jQuery('#' + c.id).css("display", "table");
// With bDivElement we will try to preserve current height of the grid panel
// to be sure that other elements on page are not disturbed
var bDivElement = jQuery(this.bDiv);
var bDivElementHeight = this.bDiv.clientHeight + "px";
bDivElement.css("height",bDivElementHeight);
this.cols[e + c.nv].style.height = "0";
f = this.headers[e + c.nv].newWidth || this.headers[e + c.nv].width;
c.colModel[e + c.nv].width = f;
this.headers[e + c.nv].width = f;
this.headers[e + c.nv].el.style.width = f + "px";
this.cols[e + c.nv].style.width = f + "px";
if (this.footers.length > 0)this.footers[e + c.nv].style.width = f + "px";
// Lines below are also added, after this.cols got width property set
// table element will be hidden and in few miliseconds table will be shown
// with correct resized columns
jQuery('#' + c.id).css("display", "none");
setTimeout(function() {
// The bDivElement height property set
bDivElement.css("height",c.height);
jQuery('#' + c.id).css("display", "table");
}, 50);
} else {
c.tblwidth = this.newWidth || c.tblwidth;
b("table:first", this.bDiv).css("width", c.tblwidth + "px");
b("table:first", this.hDiv).css("width", c.tblwidth + "px");
this.hDiv.scrollLeft = this.bDiv.scrollLeft;
if (c.footerrow) {
b("table:first", this.sDiv).css("width", c.tblwidth + "px");
this.sDiv.scrollLeft = this.bDiv.scrollLeft
}
}
b.isFunction(c.resizeStop) && c.resizeStop.call(this, f, e)
}
this.curGbox =
null;
document.onselectstart = function() {
return true
}
}
Comment lines are added, in general, Firefox 11 doesn't resizing columns if "forceFit" property is set to true. It will resize only header not cells below.
Best regards
Most Users Ever Online: 715
Currently Online:
49 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