AdvancedDataGrid的边框在弹出窗口中消失

时间:2015-03-31 04:51:21

标签: actionscript-3 flex advanceddatagrid

AdvancedDataGrid的边框正在消失。我使用相同的弹出对象实例在不同时间显示。

第一次弹出窗口和ADG边框很好但是当我下次启动弹出窗口时,边框消失了。虽然如果我尝试调整列大小,边框会重新出现。我无法得到这个问题的原因,因此无法纠正它。

我尝试重新调整ADG的可见性,并尝试调用invalidateDisplayList(),但没有成功。

* ADG = AdvancedDataGrid 我附上了代码片段。



<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
					   xmlns:s="library://ns.adobe.com/flex/spark" 
					   xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="onCC()" width="1500" height="1000">
	<s:layout>
		<s:VerticalLayout />
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.controls.advancedDataGridClasses.AdvancedDataGridSortItemRenderer;
			import mx.managers.PopUpManager;
			[Bindable]private var dp:ArrayCollection = new ArrayCollection();
			
			private function onCC():void
			{
				var obj1:Object = new Object();
				obj1.col1 = "col11";
				obj1.col2 = "col12";
				obj1.col3 = "col13";
				dp.addItem(obj1);
				
				obj1 = new Object()
				obj1.col1 = "col21";
				obj1.col2 = "col22";
				obj1.col3 = "col23";
				dp.addItem(obj1);
			}
			
			var popup:PopupPanel = new PopupPanel();
			private function launchPopup():void
			{
				
				PopUpManager.addPopUp(popup, this as DisplayObject);
				PopUpManager.centerPopUp(popup);
			}
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
		
	</fx:Declarations>
	
	<mx:AdvancedDataGrid sortableColumns="false" sortItemRenderer="{null}" dataProvider="{dp}" draggableColumns="false" >
		<mx:groupedColumns>
			<mx:AdvancedDataGridColumn headerText="PM1" dataField="col1" />
			<mx:AdvancedDataGridColumnGroup headerText="PM2" >
				<mx:AdvancedDataGridColumn headerText="NE" dataField="col2" />
				<mx:AdvancedDataGridColumn headerText="FE" dataField="col3"/>
			</mx:AdvancedDataGridColumnGroup>
		</mx:groupedColumns>
	</mx:AdvancedDataGrid>
	<mx:Button label="launch popup" click="launchPopup()" />
</s:WindowedApplication>
&#13;
&#13;
&#13;

&#13;
&#13;
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" width="1000" height="750"
			   close="titlewindow1_closeHandler(event)">
	<s:layout>
		<s:HorizontalLayout paddingLeft="20" paddingRight="20" paddingTop="20" paddingBottom="20"/>
	</s:layout>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.events.CloseEvent;
			import mx.managers.PopUpManager;
			
			[Bindable] private var dp:ArrayCollection = new ArrayCollection();
			protected function titlewindow1_closeHandler(event:CloseEvent):void
			{
				// TODO Auto-generated method stub
				PopUpManager.removePopUp(this);
			}
			
		]]>
	</fx:Script>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	
	
	<mx:AdvancedDataGrid id="dg1" sortableColumns="false" sortItemRenderer="{null}" dataProvider="{dp}" draggableColumns="false" width="100%" height="100%">
		<mx:groupedColumns>
			<mx:AdvancedDataGridColumn headerText="PM1" dataField="col1" />
			<mx:AdvancedDataGridColumnGroup headerText="PM2" >
				<mx:AdvancedDataGridColumn headerText="NE" dataField="col2" />
				<mx:AdvancedDataGridColumn headerText="FE" dataField="col3"/>
			</mx:AdvancedDataGridColumnGroup>
		</mx:groupedColumns>
	</mx:AdvancedDataGrid>
	
	<mx:AdvancedDataGrid id="dg2" sortableColumns="false" sortItemRenderer="{null}" dataProvider="{dp}" draggableColumns="false" width="100%" height="100%">
		<mx:groupedColumns>
			<mx:AdvancedDataGridColumn headerText="PM1" dataField="col1" />
			<mx:AdvancedDataGridColumnGroup headerText="PM2" >
				<mx:AdvancedDataGridColumn headerText="NE" dataField="col2" />
				<mx:AdvancedDataGridColumn headerText="FE" dataField="col3"/>
			</mx:AdvancedDataGridColumnGroup>
		</mx:groupedColumns>
	</mx:AdvancedDataGrid>
</s:TitleWindow>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

我创建了一个公共方法,该实例是网格的非空调用invalidateList()。例如:

// Update grids when the display is already instantiated
 public function updates():void{
     its grid.invalidateList();
}