AdvancedDataGrid 的边框在弹出窗口中消失
Borders of AdvancedDataGrid disappears in popup
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>
<?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>
我创建了一个 public 实例非空调用 invalidateList()
网格的方法。示例:
// Update grids when the display is already instantiated
public function updates():void{
its grid.invalidateList();
}
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>
<?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>
我创建了一个 public 实例非空调用 invalidateList()
网格的方法。示例:
// Update grids when the display is already instantiated
public function updates():void{
its grid.invalidateList();
}