Table widget with different column widths per row?
-
Is there any way to create a table widget in which each row can have differently sized columns?
-
Is there any way to create a table widget in which each row can have differently sized columns?
@Publicnamer
No. It would not be a "table" then. (Example: how would you deal with table column headers?) You can "span" multiple columns in each row (if that does what you want), but that does not make the table's real columns have different widths per row. -
I want to hide the column headers.
Regarding spanning:
So if I have 100 columns, each 15 pixels wide each, could I have some spans that are 30 pixels, others 90 pixels etc.? -
I want to hide the column headers.
Regarding spanning:
So if I have 100 columns, each 15 pixels wide each, could I have some spans that are 30 pixels, others 90 pixels etc.?@Publicnamer said in Table widget with different column widths per row?:
I want to hide the column headers.
Understood, but it does not affect that fact that table views will not allow a varying number of columns per row.
So if I have 100 columns, each 15 pixels wide each, could I have some spans that are 30 pixels, others 90 pixels etc.?
Yes, in principle. If you have a large number of narrow columns you can do quite a bit of spanning differently per row to achieve rows which look like they have varying column widths.
However, be aware this is not totally flexible. I can see two "gotchas":
-
You will end up with your data "dotted around" the columns. One row might have data in just columns 0, 33 & 67, another might have data in 20, 40, 50 & 99. Not forbidden, but could be a management issue.
-
You must still think in terms of the actual columns are in. If one row has data in column 10 spanning 20 columns, and another has data in column 15 spanning 10 columns, these are not totally independent of each other. Here, for example they "share" columns 15 to 20, with implications you can imagine for layout.
-
-
@Publicnamer said in Table widget with different column widths per row?:
I want to hide the column headers.
Understood, but it does not affect that fact that table views will not allow a varying number of columns per row.
So if I have 100 columns, each 15 pixels wide each, could I have some spans that are 30 pixels, others 90 pixels etc.?
Yes, in principle. If you have a large number of narrow columns you can do quite a bit of spanning differently per row to achieve rows which look like they have varying column widths.
However, be aware this is not totally flexible. I can see two "gotchas":
-
You will end up with your data "dotted around" the columns. One row might have data in just columns 0, 33 & 67, another might have data in 20, 40, 50 & 99. Not forbidden, but could be a management issue.
-
You must still think in terms of the actual columns are in. If one row has data in column 10 spanning 20 columns, and another has data in column 15 spanning 10 columns, these are not totally independent of each other. Here, for example they "share" columns 15 to 20, with implications you can imagine for layout.
@JonB My goal here is to basically divide the row into 2 areas each of varying size. The left area will have n columns, the right area will have m columns. To allow for fine-grained control of column sizes, I'll probably have to have n+m=100 columns and each column will be a fixed size e.g. 15 pixels.
-
-
@JonB My goal here is to basically divide the row into 2 areas each of varying size. The left area will have n columns, the right area will have m columns. To allow for fine-grained control of column sizes, I'll probably have to have n+m=100 columns and each column will be a fixed size e.g. 15 pixels.
@Publicnamer
I have replied as clearly as I can. Why don't you try the result with, say, 10 columns and have a play to see how the spanning and widths work out for you, before proceeding to full implementation? -
@Publicnamer
I have replied as clearly as I can. Why don't you try the result with, say, 10 columns and have a play to see how the spanning and widths work out for you, before proceeding to full implementation?@JonB Just curious, where is the API for this span concept that you're talking about?
-
@JonB Just curious, where is the API for this span concept that you're talking about?
-
@JonB OK, I've found that it works thanks.