GridLayout screen issue

I am using GridLayout component, where I populate cells components at runtime from screen controller. At default into xml grid i set one row and two columns, at runtime on Init event, adjust columns like this:

     public void init(Map<String, Object> params) {
    super.init(params);

    mainGrid.setColumns(5);

the result is follow, all columns after the second are all compressed right side, and only first and second are showed correcty. If I set 5 columns at design time work good.

image

Any help about this issue ?

Hello, @fala70

could you share small test project where your problem can be reproduced?

Regards,
Daniil.

image

Thank you.

I’ve reproduced your problem. The reason of the current behavior is that the GridLayout loader sets expand ratio for all columns that are defined in a screen descriptor. So to fix the problem you should add the following small snippet:

for (int i = 0; i < N_COLS; i++) {
    mainGrid.setColumnExpandRatio(i, 1);
}

Also, I’ve created an issue about this problem in our bug tracker: YouTrack.

Regards,
Daniil.

1 Like