PDA

View Full Version : Grid, method setColumnLines(true) - offset by 1px the header lines. Bug? How to fix?



Vadim Kolesnikov
31 Jan 2012, 6:13 AM
Hi All,

31222
http://www.sencha.com/examples/#basicgrid
ColumnHeader:


public void updateTotalWidth(int offset, int width) {
if (offset != -1) table.getElement().getParentElement().getStyle().setPropertyPx("width", ++offset);
table.getElement().getStyle().setProperty("width", (++width) + "px");
}

Temporarily solved the problem - override method and delete '++':
table.getElement().getStyle().setProperty("width", (width) + "px");

There is another way? Please help me.

- GXT version: 2.2.5
- Host mode / web mode / both: All
- Browser and version: All (without Opera)
- Operating System: Windows 7

smiletolead
31 Jan 2012, 6:35 PM
Looks like it is a bug.

sven
1 Feb 2012, 12:33 AM
Yes this is a known issue and is already on the list.

Vadim Kolesnikov
1 Feb 2012, 1:35 AM
Thanks. What version of wait for fix?

treblereel
24 Feb 2012, 2:39 PM
looks like my problem the same, is it ? 32127

Vadim Kolesnikov
27 Feb 2012, 4:39 AM
looks like this it.


com.extjs.gxt.ui.client.widget.grid.ColumnHeader:
updateTotalWidth(int offset, int width) {
if (offset != -1) {
table.getElement().getParentElement().getStyle().setPropertyPx("width",++offset);
}
width += headsOffset; // in some tables headsOffset == cm.getColumnCount()
table.getElement().getStyle().setProperty("width", (width) + "px");
}


I'm setting a new value for 'headsOffset' in each table :-?
You will can try to experiment :D

treblereel
27 Feb 2012, 2:48 PM
Can you explain in waht part of code you have put it ? maybe little example ?

Vadim Kolesnikov
28 Feb 2012, 12:53 AM
Oh, of course :)

I'm created class (MyGridView) that extends GridView and was need override "newColumnHeader()" method:


@Override
protected ColumnHeader newColumnHeader() {
header = new ColumnHeader(grid, cm) {
// copy & paste from the parent class (GridView).
@Override
public void updateTotalWidth(int offset, int width) {
if (offset != -1) {
table.getElement().getParentElement().getStyle().setPropertyPx("width",++offset);
}
width += headsOffset;
table.getElement().getStyle().setProperty("width", (width) + "px");
}
};
}


And was set new view for my Grid example:


Grid<Example> grid;
...
grid.setView(new MyGridView());

treblereel
28 Feb 2012, 3:18 AM
Thanks, but i use EditableTreeGrid, so it doesnt helps me
Anyway, thanks

Vadim Kolesnikov
28 Feb 2012, 3:32 AM
Anyway, try. This it is the same Grid.
No problem. You are welcome. =)