更新时间:2022-06-12 03:08:58
Flex 处理数据网格的方式是一个令人不快的异常,如果不是一个实际的错误.在 Adobe 的辩护中,弄清楚如何调整所有列的大小似乎不是一项微不足道的任务.
It is an unpleasant anomaly, if not an actual bug, in the way Flex does datagrids. In Adobe's defense, figuring out how to resize all the columns appears not to be a trivial task.
我一直处理这个问题的方法是在最后创建一个虚拟列,minWidth 为 4,没有宽度规范.然后它变成了占据松弛的可扩展列".然后我确保让其余的列有足够的空间从一开始就显示它们的数据和它们的标题渲染器,方法是给每个列一个 minWidth 和一个宽度.我唯一遇到的问题是,如果在允许的空间中显示太多列,在这种情况下,您会得到一个水平滚动条,并且所有(或大部分)赌注都关闭了.
The way I've always handled this is to make a dummy column at the end, with a minWidth of 4 and no width specification. Then that becomes the "expandable column" that takes up the slack. Then I make sure to allow the rest of the columns enough room to display their data and their header renderers from the start by giving each a minWidth and a width. The only time I have problems is if there are too many columns to display in the space allowed, in which case you get a horizontal scrollbar and all (or most) bets are off.