yafmbl
16 Jun 2009, 2:38 AM
Hi,
Platform Info:
GXT Version: Latest from SVN (as of 2009-06-16) (PS: Tested with 2.0M3 release as well, same issue there)
Hosted mode & Web Mode (IE/FireFox/Chrome/Safari)
Windows XP sp3
Problem:
We have an issue with the grids. Seemingly, grids are aligning the column headers in a weird way. (see the screenshot for a better understanding)
14316
The distrubtion gets one pixel more with each additional column. The first grid has 4 columns, and the 2nd one has 144 columns. (it gets weirder if you keep increasing the column count)
Also, when you move mouse over the header, it changes the alignment of the titles. (i marked those columns in the attachment)
here is the sample code which produces the effect.
public void onModuleLoad( )
{
try
{
Viewport viewPort = new Viewport( ) ;
viewPort.setLayout( new FitLayout( ) ) ;
viewPort.add( getTestWidget( ) ) ;
RootPanel.get( ).add( viewPort ) ;
}
catch( Throwable t )
{
t.printStackTrace( ) ;
}
}
public LayoutContainer getTestWidget( )
{
LayoutContainer container = new LayoutContainer( ) ;
Grid<ModelData> grid ;
container.setLayout( new FlowLayout( ) ) ;
List<ColumnConfig> configs = new ArrayList<ColumnConfig>( ) ;
for( int i = 0; i < 4; i++ )
{
ColumnConfig fx = new ColumnConfig( "f" + i, "f" + i, 100 ) ;
configs.add( fx ) ;
}
ColumnModel cm = new ColumnModel( configs ) ;
ListStore<ModelData> store = new ListStore<ModelData>( ) ;
grid = new Grid<ModelData>( store, cm ) ;
grid.setStyleAttribute( "borderTop", "none" ) ;
grid.setAutoExpandColumn( "f1" ) ;
grid.setBorders( true ) ;
grid.setStripeRows( true ) ;
container.add( grid ) ;
//Add second one
configs = new ArrayList<ColumnConfig>( ) ;
for( int i = 0; i < 144; i++ )
{
ColumnConfig fx = new ColumnConfig( "f" + i, "f" + i, 30 ) ;
configs.add( fx ) ;
}
cm = new ColumnModel( configs ) ;
store = new ListStore<ModelData>( ) ;
grid = new Grid<ModelData>( store, cm ) ;
grid.setStyleAttribute( "borderTop", "none" ) ;
grid.setAutoExpandColumn( "f1" ) ;
grid.setBorders( true ) ;
grid.setStripeRows( true ) ;
container.add( grid ) ;
return container ;
}
During debug, we also found some clues about source of the problem. The below method in ColumnHeader.java calculates height 1 more at each iteration:
// line 546 as of SVN version 2009-06-16
protected void adjustHeights() {
for (Head head : heads) {
if (head.isRendered()) {
// THIS ONE CALCULATES HEIGHT 1 MORE AT EACH ITERATION
int h = head.el().getParent().getHeight();
head.el().setHeight(h, true);
}
}
}
Thanks for the help.
Platform Info:
GXT Version: Latest from SVN (as of 2009-06-16) (PS: Tested with 2.0M3 release as well, same issue there)
Hosted mode & Web Mode (IE/FireFox/Chrome/Safari)
Windows XP sp3
Problem:
We have an issue with the grids. Seemingly, grids are aligning the column headers in a weird way. (see the screenshot for a better understanding)
14316
The distrubtion gets one pixel more with each additional column. The first grid has 4 columns, and the 2nd one has 144 columns. (it gets weirder if you keep increasing the column count)
Also, when you move mouse over the header, it changes the alignment of the titles. (i marked those columns in the attachment)
here is the sample code which produces the effect.
public void onModuleLoad( )
{
try
{
Viewport viewPort = new Viewport( ) ;
viewPort.setLayout( new FitLayout( ) ) ;
viewPort.add( getTestWidget( ) ) ;
RootPanel.get( ).add( viewPort ) ;
}
catch( Throwable t )
{
t.printStackTrace( ) ;
}
}
public LayoutContainer getTestWidget( )
{
LayoutContainer container = new LayoutContainer( ) ;
Grid<ModelData> grid ;
container.setLayout( new FlowLayout( ) ) ;
List<ColumnConfig> configs = new ArrayList<ColumnConfig>( ) ;
for( int i = 0; i < 4; i++ )
{
ColumnConfig fx = new ColumnConfig( "f" + i, "f" + i, 100 ) ;
configs.add( fx ) ;
}
ColumnModel cm = new ColumnModel( configs ) ;
ListStore<ModelData> store = new ListStore<ModelData>( ) ;
grid = new Grid<ModelData>( store, cm ) ;
grid.setStyleAttribute( "borderTop", "none" ) ;
grid.setAutoExpandColumn( "f1" ) ;
grid.setBorders( true ) ;
grid.setStripeRows( true ) ;
container.add( grid ) ;
//Add second one
configs = new ArrayList<ColumnConfig>( ) ;
for( int i = 0; i < 144; i++ )
{
ColumnConfig fx = new ColumnConfig( "f" + i, "f" + i, 30 ) ;
configs.add( fx ) ;
}
cm = new ColumnModel( configs ) ;
store = new ListStore<ModelData>( ) ;
grid = new Grid<ModelData>( store, cm ) ;
grid.setStyleAttribute( "borderTop", "none" ) ;
grid.setAutoExpandColumn( "f1" ) ;
grid.setBorders( true ) ;
grid.setStripeRows( true ) ;
container.add( grid ) ;
return container ;
}
During debug, we also found some clues about source of the problem. The below method in ColumnHeader.java calculates height 1 more at each iteration:
// line 546 as of SVN version 2009-06-16
protected void adjustHeights() {
for (Head head : heads) {
if (head.isRendered()) {
// THIS ONE CALCULATES HEIGHT 1 MORE AT EACH ITERATION
int h = head.el().getParent().getHeight();
head.el().setHeight(h, true);
}
}
}
Thanks for the help.