Flex AdvancedDataGrid未正确填充

时间:2012-01-11 21:00:18

标签: flash flex flex-spark advanceddatagrid

我无法在我正在处理的应用中正确填充AdvancedDataGrid。

如果我使用此页面上的示例代码http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7bf0.html在其自己的页面中一切正常但是如果我将此代码复制到我的应用程序中需要具有网格列表标题/数据的页面中填充。

需要网格的页面显示在Spark NavigatorContent元素中,我不确定这是否会以某种方式对AdvancedDataGrid行为产生负面影响。我甚至简化了包含的页面,只提供了示例代码而没有任何其他内容,但它仍然不起作用。

任何想法都将不胜感激。随意请求这里需要的更多信息,我是Flex的新手,我非常喜欢这里。

编辑:项目中的一些代码示例:

//Code from 'main page' containing the NavigatorContent
<mx:ViewStack id="viewstack1" cornerRadius="12" dropShadowVisible="false">
    <s:NavigatorContent label="Matrix View" backgroundColor="#FFFFFF">
        <temporalShift:CCCPMatrixView id="matrixView" initialize="initMatrixView()" />
    </s:NavigatorContent>
</mx:ViewStack>

//Code contained within 'CCCPMatrixView'
<?xml version="1.0"?>
<!-- dpcontrols/adg/ColumnGroupADG.mxml -->
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
    <![CDATA[
        import mx.collections.ArrayCollection;

        [Bindable]
        private var dpFlat:ArrayCollection = new ArrayCollection([
            {Region:"Southwest", Territory:"Arizona", 
                Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000}, 
            {Region:"Southwest", Territory:"Arizona", 
                Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000},  
            {Region:"Southwest", Territory:"Central California", 
                Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000},  
            {Region:"Southwest", Territory:"Nevada", 
                Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000},  
            {Region:"Southwest", Territory:"Northern California", 
                Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000}, 
            {Region:"Southwest", Territory:"Northern California", 
                Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000},  
            {Region:"Southwest", Territory:"Southern California", 
                Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000}, 
            {Region:"Southwest", Territory:"Southern California", 
                Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}
        ]);
    ]]>
</fx:Script>
<mx:AdvancedDataGrid id="myADG"
                     dataProvider="{dpFlat}"
                     width="100%" height="100%">
    <mx:groupedColumns>
        <mx:AdvancedDataGridColumn dataField="Region"/>
        <mx:AdvancedDataGridColumn dataField="Territory"/>
        <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                                   headerText="Territory Rep"/>
        <mx:AdvancedDataGridColumnGroup headerText="Revenues">    
            <mx:AdvancedDataGridColumn dataField="Actual"/>
            <mx:AdvancedDataGridColumn dataField="Estimate"/>
        </mx:AdvancedDataGridColumnGroup>    
    </mx:groupedColumns>
</mx:AdvancedDataGrid>

1 个答案:

答案 0 :(得分:0)

我觉得有点傻。事实证明它很精致,只是文字与背景颜色相同(据我所知)。添加以下CSS修复了该问题:

mx|AdvancedDataGrid {
    selection-color:#5f8ed4;
    text-selected-color:#ffffff;
    roll-over-color:#31962c;
    text-roll-over-color:#ffffff;
    font-family:ArialEmbeddedMX;
    chrome-color: #C9C9C9;
    header-style-name: "AdvancedDataGrid-HeaderStyle";
}

.AdvancedDataGrid-HeaderStyle {
    text-roll-over-color:#ffffff;
    corner-radius: 5;
    text-selected-color:#ffffff;
    color:#000000; font-size:12; 
}