PDA

View Full Version : Row Numbers in more than 2 digits



parit
6 Jun 2010, 9:51 AM
Hi, I have created a grid with 101 rows. I have added a RowNumberer but it is not showing row numbers greater than 99 correctly (Please see the attached image).

Code for the grid is as follows:



private void createGrid(String header)
{
ListStore<Result> gridStore = createDummyData();
XTemplate tpl = XTemplate.create("<p><b>Tax id</b> {organismId}</p> <p><b>Max Eval hit</b> {maxEValHitIdentifier}</p> " +
"<p><b>Min Eval hit id</b> {minEValHitIdentifier}</p> " +
"<p><b>Max Bit Score hit id</b> {maxBitScoreHitIdentifier}</p> " +
" <p><b>Min Bit Score hit id</b> {minBitScoreHitIdentifier}</p>");

RowNumberer r = new RowNumberer();
RowExpander expander = new RowExpander();
expander.setTemplate(tpl);

List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(r);
columns.add(expander);
CheckBoxSelectionModel sm = new CheckBoxSelectionModel();
columns.add(sm.getColumn());

ColumnConfig column = new ColumnConfig("organismName","HitName",127);
columns.add(column);

column = new ColumnConfig("organismId","TaxId",60);
columns.add(column);

column = new ColumnConfig("maxEVal","Max E-Val",60);
columns.add(column);

column = new ColumnConfig("minEVal","Min E-Val",60);
columns.add(column);

column = new ColumnConfig("maxBitScore","Max Bit Score",60);
columns.add(column);

column = new ColumnConfig("minBitScore","Min Bit Score",60);
columns.add(column);

column = new ColumnConfig("id","Blast File", 60);
column.setRenderer(getRenderer());
columns.add(column);
ColumnModel cm = new ColumnModel(columns);

portlet = new Portlet();
configPanel(portlet);
portlet.setLayout(new FitLayout());
portlet.setHeight(MyBlast.clientHeight/2);
portlet.setScrollMode(Scroll.AUTO);
portlet.setPinned(true);
portlet.setHeading(header);
portlet.setLayout(new FitLayout());
portlet.setTopComponent(creatToolBar(gridStore));

Grid<Result> grid1 = new Grid<Result>(gridStore, cm);
grid1.setSelectionModel(sm);
grid1.setStyleAttribute("borderTop", "none");
grid1.addPlugin(expander);
grid1.addPlugin(sm);
grid1.setBorders(true);
grid1.setLoadMask(true);
grid1.setAutoHeight(true);
grid1.getView().setForceFit(true);
configPanel(portlet);
portlet.add(grid1);
}

Please find attached the complete code.

- Parit

sven
6 Jun 2010, 10:02 AM
Column width is not high enough.

parit
6 Jun 2010, 10:11 AM
okie so I had to fix the column width of RowNumberer. Actually, I was hoping it to adjust itself with the content. anyways.. thank you for your response.