Hi,
I have a ListGrid with a single field. The contents of this field change dynamically. My requirement is to have a "minimum width" for the field as well as an autoFit setting for wider field values.
Let's say the minimum width is 200px, and the field content's width is 100px. In this case, I want the field width to be 200px. But if the content width changes to 300px, I want the field to automatically expand to 300px. I used the code:
The result is not what I expected. Let's say initially my content width is 100px. In this case, the field width is correctly set to 200px. Next, the content width changes to 300px. In this case, the field width correctly expands to 300px. However, if the content width changes back to 100px, the field width doesn't shrink back to 200px (minimum width). It stays at 300px.
In summary, if I use setWidth and setAutoFitWidth together, the auto fit only works in one direction i.e. for expanding the field. It doesn't really shrink the field back when the content shrinks.
So, is there another way to achieve my requirement of having a minimum width and also an "auto fit" setting for wider content?
I'll appreciate any help.
Thanks.
I have a ListGrid with a single field. The contents of this field change dynamically. My requirement is to have a "minimum width" for the field as well as an autoFit setting for wider field values.
Let's say the minimum width is 200px, and the field content's width is 100px. In this case, I want the field width to be 200px. But if the content width changes to 300px, I want the field to automatically expand to 300px. I used the code:
Code:
field.setWidth(200); field.setAutoFitWidth(true);
In summary, if I use setWidth and setAutoFitWidth together, the auto fit only works in one direction i.e. for expanding the field. It doesn't really shrink the field back when the content shrinks.
So, is there another way to achieve my requirement of having a minimum width and also an "auto fit" setting for wider content?
I'll appreciate any help.
Thanks.
Comment