How to fill available tableview width with columns? - kotlin

When tableview is created, the default behaviour of columns is to leave a lot of empty space. Is there a way to automatically fill the space?
One solution is described here:
JavaFX 2 Automatic Column Width
but this seems a little cumbersome.

TornadoFX comes with an advanced column resize policy called SmartResize. You assign it to a TableView like this:
columnResizePolicy = SmartResize.POLICY
By default it tries to do something useful depending on the data, and it will assign any left over width to the last column.
You can configure resizing options per column by calling the appropriate configurator function. For example, to tell the policy to give remaining width to a given column:
column("Name", Person::nameProperty).remainingWidth()
You can configure multiple columns to receive remaning width, so that they will share the remaining width between them.
contentWidth() will make sure the column width fits the content, with optional additional padding: contentWidth(padding = 50.0).
Most resize options also take an optional useAsMin parameter which will enforce the given setting as a minimum width for the column. useAsMax does the same for max width. You will get a fixed size by setting both useAsMin and useAsMax or specifying the fixedWidth(width) option.
You can distribute space using the weigthedWidth(weightNum) function, or even the pctWidth(pctNum) function. All these modes can be combined
Please see the TornadoFX Guide chapter about the resize policy for more information:

Related

Is there a way to set minimum width on individual columns in C1FlexGrid?

Working with vb.net WinForms. I can set minimum width for the column collection of the flexgrid, but is there a way to make the minimum width different for each column? I cannot find anything that supports this. Pretty straightforward question but if any more info is needed let me know.
Newer C1FlexGrid versions provide the feature "Column.StarWidth", which is used to size all columns based on the available space in the parent control.
Here, you can specify a min width for each col:
c1FlexGrid.Cols(2).StarWidth = "*";
c1FlexGrid.Cols(2).MinWidth = 100;
See https://www.grapecity.com/componentone/docs/win/online-flexgrid/C1.Win.C1FlexGrid.4.5.2~C1.Win.C1FlexGrid.Column~MinWidth.html
The grid has a Cols property, you pass in the index of the column, then the Column has a width property:
Example:
grid.Cols[0].Width = 50
References
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.C1FlexGrid.html
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.ColumnCollection.html
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.Column_members.html
http://helpcentral.componentone.com/nethelp/c1flexgrid/C1.Win.C1FlexGrid.4~C1.Win.C1FlexGrid.Column~Width.html

Line_width not working in Vulkan

I enabled wide_line feature in VkPhysicalDeviceFeatures and i am giving appropriate value in pRasterizationState as well. But i dont see the width increased for the lines. What am I missing here?
Does the implementation support wide lines? Check the value of VkphysicalDeviceFeatures:: wideLines you get from vkGetPhysicalDeviceFeatures. Also check the lineWidthRange and lineWidthGranularity in VkPhysicalDeviceLimits.
Are you setting VK_DYNAMIC_STATE_LINE_WIDTH in VkPipelineDynamicStateCreateInfo::pDynamicStates? If so, you need to set the line width using vkCmdSetLineWidth rather than VkPipelineRasterizationStateCreateInfo::lineWidth.

How to specify different editor widgets for the same column in Dojo DataGrid

I am wondering, is there an official way to specify a different widget editor for the same column in a DataGrid (different rows)?
I found dojox.grid.cells._MultipleEditor, but it is quite complicated and not officially supported.
This is for creating things like a property sheet with DataGrid.
EDIT: People seem to suggest using dgrid. However, I am not sure if dgrid has this feature. Also, unfortunately, ... drum roll... horror music... I must support IE6.
Well, there seems to be a way to do it. Doesn't seem to show much negative side effects (so far)...
Create one column for each value type, one after the other.
Tag each column with a CSS class to indicate its value type (via classes). For example: classes="multivalue int"
For each column, tag it with the correct editor widget and the appropriate constraint & options.
Put styles on each row (with onStyleRow) that correspond to each type. For example, add a type-int class to the row that has an int type.
Put in a CSS style that initially hides all the multi-valued cells:
.dojoxGridCell.multivalue { display:none; }
Un-hide all the cells with the correct type:
.dojoxGridRow.type-int .dojoxGridCell.multivalue.int
{
display:table-cell;
*display:block; /* For IE6/7 */
}
For this to work, obviously, each row must match exactly one column.
Obviously, you must set all these fields to the same property name. DataGrid allows you to do that.
Put display:none (via CSS etc.) on all the header cells of multi-valued columns except the first one. Otherwise, you'll end up with too many header cells.

Grouped table view -- section spacing

In a grouped table view can I control the spacing between two sections?
Agree with 'viking'.. If you are still having troubles, I have noticed that if you create the table through IB it automatically creates a table header/footer section. If you go into the measurments(in IB) and decrease/increase the height of each section you will see the spacing between grouped sections change.
tableView:heightForHeaderInSection: and tableView:heightForFooterInSection:
together these control the space in between sections of a grouped UITableView. You cannot return 0, it will use the default value if you do, so use a small float (0.01) to reduce the space to almost nothing.
implement tableView:viewForHeaderInSection: or tableView:heightForHeaderInSection:

Displaying/Formatting Tabular Data (web)

In my example I have a table where each row is a user for example. Columns could include their name, address, email address, etc. I now need to add a column for (hypothetical example) their cat's names. While most people will have no cats and some people will have 1- 2 cats there will be the occasional person with 20 cats that create one very long row in the table. This is giving me an issue in presentation and for filtering/searching for cat names. Is there a good solution to displaying this type of data?
Have the first 50 (or whatever) characters of the field displayed as normal then put the rest in a block with its visibility set to hidden through CSS. Include a link / button / icon that will allow the user to toggle the visibility so they can see the entire value.
Several options:
Set a maximum width for the cell and allow the data to wrap
Place the content inside a wrapper tag (such as a div) and set the div with a fixed width/height and style of overflow:hidden to ensure that a particularly long word doesn't force out the width of the cell.
Truncate the output text on the server side
For cases #2 and #3, set the Title attribute of the TD tag to contain the full non-truncated text. This will present itself as a tooltip when hovering over the cell.
I would mention other CSS-based solutions but they're very sparsely supported right now, so not worth mentioning.
You might want to try doing something like what SO does. Namely, once someone reaches a certain point in their Rep, it suffixes the number and appromixates it. Ex. 10k instead of 10,236.
That way the numbers don't get out of hand.