-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I create grids dynamically everywhere, I create the columns,rows, etc.. all on the fly in Java. However, the grid itself is always defined in the .zul file which allows me to specify that it has columns :
<dhUserGrid id="_userGrid" width="300px">
<columns>
<column/>
</columns>
</dhUserGrid>
I now want to create the grid 100% in java and then just set it's parent also in the java :
So the zul would have no entry except for the parent :
<groupbox id="_gridParent"/>
The java would have :
DHeUserGrid _userGrid = new DHeUserGrid();
_userGrid.setParent(gridParent);
When I do this, my code that creates the columns for the grid throws an exception since the Columns are null when the grid.getColumns() is called. There is no method to set the columns, how can I do this without having to specify the grid in the zul file with columns???
private void buildColumns()
{
// !!!! getColumns RETURNS NULL !!!!!
_grid.getColumns().getChildren().clear();
int i = 0;
if (_bShowLabels == true)
{
Column newColumn = new Column();
newColumn.setAlign("center");
newColumn.setWidth(_labelColumnWidth);
_grid.getColumns().appendChild(newColumn);
i++;
}
while (i <=_maxColumns)
{
Column newColumn = new Column();
newColumn.setAlign("center");
if (i != 0)
newColumn.setWidth(_buttonColumnWidth);
else
newColumn.setWidth(_buttonColumnWidth);
_grid.getColumns().appendChild(newColumn);
i++;
}
}
new Columns().setParent(grid);
Asked: 2013-04-12 20:03:25 +0800
Seen: 73 times
Last updated: Apr 12 '13
composite component help [closed]
EL in a forEach @command not working?
Different template for each grid row
Cardlayout animation is broken
Grid RowRender slow using 6.5.1 and sizable=true
setVisible(false), component will load or not
Decimalbox and doublebox value rounded on iPad
history management with page status