Join cells in Grid footer row with dynamical columns ID

I try to use the new Grid component.
In my case the columns ID are dynamical… everything is OK.
Now I want to add the footer row and merge all the cells of this row.
I need to use join(…) but in my case the arguments of this method are dynamic objects.
How can I write it ?
I tried many ways : construct a string, pass an array of FooterCell.
Each time it raises the same exception “Cell does not exist on this row”.

Thanks for your help.

It would probably be good to give a bit more details about how they are dynamical. In any case, regardless of how you generate them, you need the property IDs to refer to the columns or cells in the footer.

The columns ID are set in configuration. In my code above, they are provided by the List “lstVisibleColumns”.
I wrote this piece of code which raises exception :

   this.footerRow = this.appendFooterRow();
   Grid.FooterCell joinedColumns = new Grid.FooterCell[100]

Iterator itVisibleColumns = this.lstVisibleColumns.iterator();
int index = 0;
String idColumn =;
if(index >= this.getFrozenColumnCount()) // On enlève les colonnes figées
Grid.FooterCell cell = this.footerRow.getCell(idColumn);
= cell;
FooterCell footer = this.footerRow.join(joinedColumns);

For one thing, the joinedColumns is an array of length 100 and you’re passing it entirely to the join() method, even though it’s only filled partially. The join() accepts a Set, so perhaps you could collect the footer cells in a HashSet or something.

Another issue could be if the joined cells are not continuous - only adjoining cells can be joined… You’re joining all non-frozen cells, so that should be OK. However, you’ve got some invisible columns and they could cause trouble with joining; I haven’t checked how that works. Perhaps there’s no problem with that.

I have exactly the same problem using a HashSet instead of the array. That’s what I’ve done first.
Anyway, you confirm that my code uses the join(…) method in a correct way ?
I will check if there is a problem in the columns like you say, but I don’t think so.

There’s many possible problem sources with the code. For example, what is the type of itVisibleColumns? You’re assuming that the iterator gets the items in index order, but if it’s for example a HashSet, the columns are not iterated in order and the way how you skip the frozen columns won’t work.

OK, I see. I haven’t thought about this possible problem, which could explain why it doesn’t work.
Thanks. I’ll change the way I read mi columns ID.

OK I finally made it work. Here is the code sample which works fine :

    ArrayList<String> joinedColumns = new ArrayList<String>();
    for(int i=0; i<this.lstVisibleColumns.size(); i++)
        if(i >= this.getFrozenColumnCount())       
            String idColumn = this.lstVisibleColumns.get(i);
    FooterCell footer = this.footerRow.join(joinedColumns.toArray());