Flex 3 中的列大小调整
看看这段代码(无法将其粘贴到此处,它不适合)它代表了我真正的应用程序结构: mxml 源代码
编辑:代码的相关部分:
<mx:VBox width="100%" height="100%">
<mx:HBox width="100%" horizontalScrollPolicy="off" height="100%">
<mx:VBox width="100%" verticalScrollPolicy="off" height="100%">
<mx:DataGrid height="100%" headerHeight="40" width="100%" wordWrap="true">
<mx:columns>
<mx:DataGridColumn dataField="serial_number" minWidth="60"
width="60" headerText="serial number"/>
<mx:DataGridColumn dataField="int_number" minWidth="80"
width="80" headerText="int. number"/>
<mx:DataGridColumn dataField="ext_number" minWidth="200"
width="200" headerText="ext. number"/>
<mx:DataGridColumn dataField="desc" minWidth="200"
headerText="description"/>
<mx:DataGridColumn dataField="issued_by" minWidth="100"
width="100" headerText="issued by"/>
<mx:DataGridColumn dataField="contractual_date" minWidth="85"
width="85" headerText="contractual date" />
<mx:DataGridColumn dataField="file_size" minWidth="60"
width="60" headerText="file size"/>
<mx:DataGridColumn dataField="n_sheets" minWidth="60"
width="60" headerText="n. of sheets"/>
<mx:DataGridColumn dataField="contains_drawing" minWidth="65"
width="65" headerText="contains drawing"/>
<mx:DataGridColumn dataField="issue_at_shipment" minWidth="65"
width="65" headerText="issue at shipment"/>
<mx:DataGridColumn dataField="rev_max_int_number" minWidth="65"
width="65" headerText="last rev"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:HBox>
</mx:VBox>
这是编译后的您可以在线查看版本: 已编译 swf
现在..调整一下窗口大小,看看有多么奇怪列调整大小!我想要获得的行为是固定除描述列之外的所有列,我没有指定描述列的宽度,只指定了 minWidth 属性。
谢谢
look at this code (couldn't paste it here it doesn't fit)it represent my real app structure:
mxml source code
EDIT: the relevant part of the code:
<mx:VBox width="100%" height="100%">
<mx:HBox width="100%" horizontalScrollPolicy="off" height="100%">
<mx:VBox width="100%" verticalScrollPolicy="off" height="100%">
<mx:DataGrid height="100%" headerHeight="40" width="100%" wordWrap="true">
<mx:columns>
<mx:DataGridColumn dataField="serial_number" minWidth="60"
width="60" headerText="serial number"/>
<mx:DataGridColumn dataField="int_number" minWidth="80"
width="80" headerText="int. number"/>
<mx:DataGridColumn dataField="ext_number" minWidth="200"
width="200" headerText="ext. number"/>
<mx:DataGridColumn dataField="desc" minWidth="200"
headerText="description"/>
<mx:DataGridColumn dataField="issued_by" minWidth="100"
width="100" headerText="issued by"/>
<mx:DataGridColumn dataField="contractual_date" minWidth="85"
width="85" headerText="contractual date" />
<mx:DataGridColumn dataField="file_size" minWidth="60"
width="60" headerText="file size"/>
<mx:DataGridColumn dataField="n_sheets" minWidth="60"
width="60" headerText="n. of sheets"/>
<mx:DataGridColumn dataField="contains_drawing" minWidth="65"
width="65" headerText="contains drawing"/>
<mx:DataGridColumn dataField="issue_at_shipment" minWidth="65"
width="65" headerText="issue at shipment"/>
<mx:DataGridColumn dataField="rev_max_int_number" minWidth="65"
width="65" headerText="last rev"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:HBox>
</mx:VBox>
this is the compiled version you can view online:
compiled swf
now.. resize a bit the window, look at how oddly the colums resize! The behaviour I'd like to obtain is to have all columns fixed except for the description column, for which I haven't speified the width but only the minWidth property.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想说将宽度绑定到您想要的值,这样它就不会调整大小:
让我知道,谢谢!
I would say to bind the width to the value that you want, that way it wont resize:
Let me know, thanks!
请注意将来的搜索:在将 (3.5b SDK) DataGrid 添加到显示列表(也称为动态添加的列)后添加的列上设置
minWidth
可能会使整个网格处于非常糟糕的状态,其中水平滚动条拇指不准确地反映了比实际存在更宽的网格。如果通过将列对象(已设置 .
minWidth
)推送到数组并将该数组分配给DataGrid.columns
来添加列,则网格的行为就像它认为它更宽一样比实际情况更宽:解决方案是:不要这样做(即使用 .
minWidth
属性)。干杯
Just a note for future searches: setting
minWidth
on columns added after the (3.5b SDK) DataGrid is added to a display list (aka dynamically added columns) can put the entire grid in a very bad state where the horizontal scroll bar thumb is inaccurately reflecting a wider grid than actually exists.If one adds columns by pushing column objects (that have .
minWidth
set) to an array and assigning that array toDataGrid.columns
, the grid acts like it thinks it is wider than it really is:The solution is: don't do that (use the .
minWidth
property, that is).Cheers