Flex AdvancedDataGrid 未正确填充

发布于 2024-12-26 04:03:26 字数 3262 浏览 0 评论 0原文

我无法在我正在开发的应用程序中正确填充 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>

I'm having trouble getting an AdvancedDataGrid to populate properly within an app I'm working on.

If I use the sample code found on this page http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7bf0.html in it's own page everything works fine but if I copy this code into the page within my app that needs to have the grid the column headers/data are not populated.

The page that needs the grid is displayed within a Spark NavigatorContent element, I'm not sure if this could somehow adversely effect the AdvancedDataGrid behaviour. I've even simplified the contained page to have just the sample code without anything else and it still does not work.

Any ideas would be greatly appreciated. Feel free to request any more info needed here, I'm fairly new to Flex and am pretty stuck here.

EDIT: Some code sample from the project:

//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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七颜 2025-01-02 04:03:26

嗯,我觉得有点傻。事实证明它填充得很好,只是文本的颜色与背景的颜色相同(据我所知)。添加以下 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; 
}

Well I feel a little silly. Turns out it was populating fine and it was just that the text was the same color as the background (as far as I can tell). Adding the following CSS fixed the issue:

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; 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文