GWT DataGrid resizes the columns - gwt

From what I understand the DataGrid auto resizes the columns.
What I would like is DataGrid to respect the column widths I set, and to show the horizontal scrollers accordingly. Is there a way to achieve this?

DataGrid gives you complete control over the width of its columns.
For example, if you set the width of all columns in pixels except for one column which has a width equal to 100%, then all columns will have exactly the width you specified, except for the percentage column which will shrink or expand based on the width of a DataGrid itself. If you want all columns to have fixed width, then you should set the width of the entire DataGrid explicitly in pixels.
There is also an important .setMinimumTableWidth method. You can use it to tell the DataGrid that it can resize with the width of its parent container, but never be smaller than a certain number of pixels. In this case, if a parent container is too small to accommodate all columns at their desired width, the horizontal scrollbar will appear.

Related

How to adjust the width of the ag-grid container based on its contents?

In ag-grid, the value of domLayout can be set to autoHeight in order to disable vertical scrolling of the ag-grid panel. Instead, the entire page adapts its height to show all the rows.
How can I have the same behavior for the horizontal scrolling?
There is the suppressHorizontalScroll option when set to true hides the horizontal scroll bar, but this doesn't force the entire page to have a scroll. Instead, the overflowing content is just hidden.
you can do this to some extent by juggling the minWidth, maxWidth, and width attributes on your columns while setting the width of the columns automatically based on their content using the gridColumnApi.autoSizeColumns(colId) method.
I say to some extent because it is quite hard, with agGrid, to set different row sizes for rows with certain cells having a lot of text or big images in them. This would force some columns to expand to accommodate for the content, or just clip it completely. Thus forcing the horizontal scroll.
Note : for the method above to work, you need to call gridColumnApi.autoSizeColumns(colId) after you get your rows setUp.

Setting row to minimum child height flutter

I'm trying to produce a widget like this below to be contained inside of a listview. I have managed an effect like this rather simply based on the example given on the flutter website for YouTube. However, the part I'm struggling with is that I would like the image to resize vertically depending on how large the text is.
Currently this is created with a row. If possible I'd like to set the row height somehow but only dependent on the height of the text. As some elements will have more text and some will have less I would like to have the image fill the vertical space so the height is the same as the text height.
I basically want this - https://api.flutter.dev/flutter/material/ListTile-class.html#material.ListTile.4
but where the image height on the left matches the text height on the right
Thanks in advance!

How do I create a wide ag-grid without clipping or scrolling?

How do I make an ag-grid instance of arbitrary width, as determined by columns, without horizontal scrolling (on the element) and without clipping?
So, if I have 20 columns averaging 100 pixels wide, then the grid is 2000 pixels wide (and will make the BROWSER horizontal scroll appear). The grid will not have its own horizontal scroll and will not be clipped to whatever the browser width is.

itext -- How do setMinimumSize() and setFixedSize() interact?

Is it well-defined in iText to call setMinimumSize(15) on some cells in a row, and setFixedSize(15) on the other cells of the same row?
What I would like is for iText to increase the row height to accommodate the text in the cells whose minimum height is set, while letting text in cells set to a fixed height clip. Is that what iText does?
If not, how do I achieve this? Thanks.
While we're at it, am I correct that calling neither setMinimumSize() nor setFixedSize() is equivalent to calling setMinimumSize(0) -- iText makes the cell as tall as it needs to be to accommodate the text?
This is with iText 2.1.6.
I already explained in a comment that setFixedHeight() always gets preference. If you use setMinimumHeight() and setFixedHeight() in the same row, and you define a minimum height along with a fixed height, the fixed height prevails.
if the minimum height is set to 30pt and the fixed height is 60pt, the height will be 60pt, no matter how much content is added to the cell.
if the minimum height is set to 60pt and the fixed height is 60pt, the height will be 60pt, no matter how much content is added to the cell.
if the minimum height is set to 120pt and the fixed height is 60pt, the height will be 60pt, no matter how much content is added to the cell.
If different fixed heights are defined, the highest value is taken. For instance: if you have a row where one cell has a fixed height (e.g 120 pt) that is higher than the fixed height of another cell (e.g. 60 pt), then the highest value (in this case 120) prevails.
You claim that this isn't mentioned in the book I wrote. Please note that the book counts about 600 pages. A lot of text I wrote was edited away by the publisher. Otherwise the book would have been a thousand pages and more.
You could have written a small test example, such as the FixedHeightCell example. Please take a look at the resulting PDF. In row D all the cells have a fixed height of 60 pt. In row E, most cells also have a fixed height of 60, but the cell in column 4 has a fixed height of 120, hence the height of the row is 120. Then there's row F, with a fixed height of 60 pt and a minimum height of 120 pt. Although we add text that doesn't fit the cell in column 2, the content is truncated.

Is there a way to enforce inequality constraints on widget size?

I have a CellTable widget which displays some data.
If there are many rows, I want the height of the widget to be capped at (say) 300 pixels (I can accomplish this by wrapping with a ScrollPanel).
However, if there are only a few rows, I don't want the ScrollPanel to use all 300 pixels of height. I just want it to be tall enough to contain all the data.
It seems like I want to set a ScrollPanel height which means "as large as the data requires, but no larger than 300px."
Is there a simple way to do this, or do I need to manually re-set the height in accordance with this constraint every time the celltable's rowdata changes?
The simplest way is to put the CellTable in a <div> or FlowPanel and set a CSS max-height: 300px for that container.