Create Grid Columns in Java ONLY

asked 2013-04-12 20:03:25 +0800

ansancle gravatar image ansancle
317 9

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">

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();

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 !!!!!
    int i = 0;
    if (_bShowLabels == true)
        Column newColumn = new Column();
    while (i <=_maxColumns)
        Column newColumn = new Column();
        if (i != 0)
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-12 23:02:05 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6

new Columns().setParent(grid);

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2013-04-12 20:03:25 +0800

Seen: 65 times

Last updated: Apr 12 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More