How to set max table row width when Table is scrollable X

5 views
Skip to first unread message

Mark Bolduc

unread,
Feb 3, 2020, 4:39:24 PM2/3/20
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA Netbeans 11
Desktop OS Windows 10 Pro
Simulator Latest
Device PC, Android, IOS

I have a com.codename1.ui.table.Table (AInventoryTable) of 13 columns that are AInventoryTable.setScrollableX(true);
Unfortunately Each column is much wider than necessary and therefore requires more user scrolling than I like.

Please see 2 attachments (PartTable_1.JPG is left view of row and PartTable_2.JPG is the right portion)
Each column constraint has been set to con.setWidthPercentage(percentages[column]);
However the total scrollable width is too great.

Is there a method to adjust this so the colums are not so padded with empty space?

Regards


PartTable_2.JPG
PartTable_1.JPG

Shai Almog

unread,
Feb 3, 2020, 9:07:36 PM2/3/20
to CodenameOne Discussions
That's odd. Do you override createCell or the constraint method?
Any other changes in the class?
I'm assuming these cells are editable.

Mark Bolduc

unread,
Feb 4, 2020, 8:54:56 AM2/4/20
to CodenameOne Discussions
Thanks for the hint.

                @Override
                protected Component createCell(Object value, final int row, final int column, boolean editable) {
                    if (row == -1) {
                        Component headercell = super.createCell(value, row, column, editable);
                        headercell = new TextArea((String) value);
                        ((TextArea)headercell).setColumns(5);
                        ((TextArea)headercell).setRows(1);
                        headercell.setEnabled(false);
                        headercell.setFlatten(false);
                        headercell.setUIID("CustComplaintsTableHeader");
                        return headercell;
                    }
I use TextArea as my header cell, so I can do multi line text, explicitly setting the colums solved the problem.

Thatns again

Regards.
Reply all
Reply to author
Forward
0 new messages