-
2 Oct 2010 7:05 AM #1
[FNR] GroupingView group separator rendering problem + solution proposal
[FNR] GroupingView group separator rendering problem + solution proposal
Hi there!
The problem:
Group separator (I mean the horizontal bar with group name and collapse/expand button) width is equal to browser window width. So if grid content is wider than browser window, after horizontal scrolling group separator seems to be cut. For example, if browser window is 1280px width, and grid width is 2000px, group separator ends at 1280px counting from left edge of screen. This does not affect functionality, but looks really bad.
The source:
I've examined GXT code carefully and found out, that in com.extjs.gxt.ui.client.widget.grid.GroupingView line 281 width is passed to the style attribute:
And it's set to the correct width value! So, for example, in previous example, gstyle is equal to "width:2000;". Generated HTML with this values is returned to GridView.renderRows and then GridView.refresh methods, the latter calls following code in line 543:Code:String gstyle = "width:" + getTotalWidth() + ";";
...and there it fails. Element's innerHTML is set and rendered rows are visible in browser, but DOM inspector shows that "style" value is empty.Code:mainBody.setInnerHtml(renderRows(0, -1));
Solution:
Solution is surprisingly simple and safe (very unlikely to cause any regressions). When a numerical value is set, CSS standard requires a unit.
The following code (suggested replacement for com.extjs.gxt.ui.client.widget.grid.GroupingView/281):
would produce "width:2000px;" which solves the problem. Checked.Code:String gstyle = "width:" + getTotalWidth() + "px;";
Workaround:
Until this bug is fixed this way or another, I'd like to share my workaround with others. This one is dirty, like most workarounds, but works well
Just use this class instead of original GroupingView.
Cheers!Code:public class FixedGroupingView extends GroupingView { @Override protected void doGroupStart(StringBuilder buf, GroupColumnData g, List<ColumnData> cs, int colCount) { final String fixedStyle=g.style.replace(";", "px"); buf.append(templates.startGroup(g.groupId, g.css, fixedStyle, g.group.toString())); } }
PS: What bothers me is that in Ext GWT 2.2.0 Explorer, there is a "px" after width value. Either its NOT 2.2.0 there, or it's magic
-
4 Oct 2010 4:11 AM #2
Thanks for this detailed report. This is fixed now in SVN as of revision 2254
-
4 Oct 2010 6:22 AM #3
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[FNR] Header group alignment ignored
By The_Jackal in forum Ext GWT: Bugs (2.x)Replies: 3Last Post: 23 Jun 2010, 3:59 PM -
[FNR] SimpleComboValue deserialization problem (with solution)
By bandesz in forum Ext GWT: Bugs (1.x)Replies: 5Last Post: 29 Jun 2009, 6:29 AM -
[FIXED][2.2.1] GroupingView line does not span to width of grid (Solution included)
By JamesC in forum Ext 2.x: BugsReplies: 1Last Post: 20 Feb 2009, 2:15 PM


Reply With Quote