读书人

AdvancedDataGrid 选择框错位有关问题

发布时间: 2012-03-14 12:01:13 作者: rapoo

AdvancedDataGrid 选择框错位问题
实例如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" height="700" >
<mx:Script>
<![CDATA[

import mx.collections.ArrayCollection;

[Bindable]
private var dataSource:ArrayCollection = new ArrayCollection([
{xh:1},{xh:2},{xh:3},{xh:4},{xh:5},{xh:6},{xh:7},{xh:8},{xh:9},{xh:10}
]);

]]>
</mx:Script>

<mx:Canvas verticalScrollBarStyleName="hh" height="614" width="831.5" horizontalCenter="-1" verticalCenter="0" verticalScrollPolicy="auto">

<mx:AdvancedDataGrid id="dg1" sortableColumns="false" rowCount="5" designViewDataType="flat"
dataProvider="{dataSource}" height="441" width="811.5" fontSize="14" fontFamily="Times New Roman" editable="true"
enabled="true" x="10" y="55" sortExpertMode="true"
horizontalScrollPolicy="auto" verticalScrollPolicy="auto" >

<mx:groupedColumns>
<mx:AdvancedDataGridColumn headerText="序号" dataField="xh" width="60" textAlign="center" editable="false"/>
<mx:AdvancedDataGridColumn headerText="COLUMN1" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN2" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN3" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN4" width="120" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN5" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN6" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN7" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN8" width="100" textAlign="center"/>
<mx:AdvancedDataGridColumn headerText="COLUMN8" width="100" textAlign="center"/>
</mx:groupedColumns>
</mx:AdvancedDataGrid>

</mx:Canvas>
</mx:Application>

当有滚动条,并且选择后几行的时候,选择框出现错位问题,如果不用<mx:groupedColumns> 改用<mx:columns> 时没有此问题,但是由于所绘的表格表头有和并列的需要,因此必须用 <mx:groupedColumns>,所以请教高手如何解决选择框错位问题,谢谢!

[解决办法]
flex自带的bug,在初始化以后,执行一下
grid.columns = grid.columns;
让内部重新计算一下。

读书人网 >flex

热点推荐