flex DataGrid数据翻页的添加特效,该怎么解决
flex DataGrid数据翻页的添加特效现在我想在有分页的DataGrid控件加一个翻页的效果, 没有分页的DataGrid不
flex DataGrid数据翻页的添加特效
现在我想在有分页的DataGrid控件加一个翻页的效果, 没有分页的DataGrid不需要效果,我的所有分页是一个控件,这样如何实现,
XML code <mx:DataGrid id="dg" headerHeight="28" rowHeight="27" width="100%" height="100%" verticalAlign="middle" dataProvider="{users}"> <mx:columns> <mx:DataGridColumn width="60" headerText="用户名" dataField="name"/> <mx:DataGridColumn width="80" headerText="登入名" dataField="loginName" /> <mx:DataGridColumn width="80" headerText="部门" dataField="department" /> </mx:columns> </mx:DataGrid> <!-- 下面这是我分页的控件 --> <custom:Pagination id="pagination" />
像我上面的情况如何实现,是每个Module里面有分页的DataGrid加特效呢,还是可以有什么简便的方法去实现,谢谢大侠们指教
[解决办法]你可以这样设计的你分页组件。
自定义一个分页组件,他可以是一个Box.
你已经写好的分页组件放在里面,并且在这里面加特效(好处是代码只出现在组件内部,以便以后更改效果)。
同时里面有个属性dataGrid来接收组件外部页面的dataGrid。
适宜代码:
private var _dataGrid:DataGrid;
public function set dataGrid(value:DataGrid):void {
_dataGrid = value;
this.addChildAt(value,0);// 把页面的表格传递到分页组件里面,以便以后分页时,修改数据等等。
}
页面调用时:
<custom:Pagination id="pagination" >
<custom:dataGrid>
<mx:DataGrid id="dg" headerHeight="28" rowHeight="27" width="100%" height="100%" verticalAlign="middle" dataProvider="{users}">
<mx:columns>
<mx:DataGridColumn width="60" headerText="用户名" dataField="name"/>
<mx:DataGridColumn width="80" headerText="登入名" dataField="loginName" />
<mx:DataGridColumn width="80" headerText="部门" dataField="department" />
</mx:columns>
</mx:DataGrid>
</custom:dataGrid>
</custom:Pagination>
[解决办法]楼主,要实现什么特效。建议可以写在分页组件内