扩展 AdvancedDataGridRenderer 时出错

发布于 2024-10-27 10:42:07 字数 2192 浏览 4 评论 0原文

我已经像这样设置了 itemrenderer 包:

package myrenderers { 导入 mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer;

public class theHeaderRenderer extends AdvancedDataGridItemRenderer
{
    public function theHeaderRenderer()
    {
        super();
        setStyle("verticalAlign","middle"); 
    }
}

但是

,当我在 AdvancedDataGridColumn 标记中包含以下几行时,

            <fx:Component>
                <myrenderers:theHeaderRenderer"/>
            </fx:Component>

        </mx:headerRenderer>

            <fx:Component>
                <renderers:someotherrenderer/>
            </fx:Component>

        </mx:itemRenderer>

我收到以下错误:

TypeError:错误 #1034:类型强制失败:无法将 mx.controls.dataGridClasses::DataGridListData@ac84f81 转换为 mx.controls.advancedDataGridClasses.AdvancedDataGridListData。 在 mx.controls.advancedDataGridClasses::AdvancedDataGridItemRenderer/set listData()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\advancedDataGridClasses\AdvancedDataGridItemRenderer.as:232] 在 mx.controls::DataGrid/http://www.adobe.com/2006/flex/mx/internal::calculateHeaderHeight()[E:\dev\4.x\frameworks\projects\framework\src\mx\控件\DataGrid.as:2182] 在 mx.controls.dataGridClasses::DataGridHeader/measure()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridHeader.as:201] 在 mx.core::UIComponent/measureSizes()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8216] 在 mx.core::UIComponent/validateSize()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8140] 在 mx.managers::LayoutManager/validateSize()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:617] 在 mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:709] 在 mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

任何人都可以建议我如何来跨越这个问题?

谢谢

I have set the itemrenderer package like that:

package myrenderers
{
import mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer;

public class theHeaderRenderer extends AdvancedDataGridItemRenderer
{
    public function theHeaderRenderer()
    {
        super();
        setStyle("verticalAlign","middle"); 
    }
}

}

However when I include the following lines in my AdvancedDataGridColumn tag,

            <fx:Component>
                <myrenderers:theHeaderRenderer"/>
            </fx:Component>

        </mx:headerRenderer>

            <fx:Component>
                <renderers:someotherrenderer/>
            </fx:Component>

        </mx:itemRenderer>

I get the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert mx.controls.dataGridClasses::DataGridListData@ac84f81 to mx.controls.advancedDataGridClasses.AdvancedDataGridListData.
at mx.controls.advancedDataGridClasses::AdvancedDataGridItemRenderer/set listData()[E:\dev\4.x\frameworks\projects\datavisualization\src\mx\controls\advancedDataGridClasses\AdvancedDataGridItemRenderer.as:232]
at mx.controls::DataGrid/http://www.adobe.com/2006/flex/mx/internal::calculateHeaderHeight()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\DataGrid.as:2182]
at mx.controls.dataGridClasses::DataGridHeader/measure()[E:\dev\4.x\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridHeader.as:201]
at mx.core::UIComponent/measureSizes()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8216]
at mx.core::UIComponent/validateSize()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:8140]
at mx.managers::LayoutManager/validateSize()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:617]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:709]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]

Can anyone suggest how I can come across this problem?

Thank you

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

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

发布评论

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

评论(1

岁月无声 2024-11-03 10:42:07

首先,我建议您从 AdvancedDataGridHeaderRenderer 而不是 AdvancedDataGridItemRenderer 扩展自定义 headerRenderer。

其次,看起来您正在将 mx:DataGridmx:AdvancedDataGrid 混合在一起。我想这就是你的类型强制错误的原因。确保您的 MXML 看起来像这样:

<mx:AdvancedDataGrid>
    <mx:columns>
        <mx:AdvancedDataGridColumn dataField="foo" headerRenderer="myrenderers.theHeaderRenderer"/>
    </mx:columns>
</mx:AdvancedDataGrid>

First, I'd recommend you extend your custom headerRenderer from AdvancedDataGridHeaderRenderer instead of AdvancedDataGridItemRenderer.

Second, it looks like you are mixing the mx:DataGrid with the mx:AdvancedDataGrid. I guess that's the cause for your type coercion error. Make sure that your MXML looks something like this:

<mx:AdvancedDataGrid>
    <mx:columns>
        <mx:AdvancedDataGridColumn dataField="foo" headerRenderer="myrenderers.theHeaderRenderer"/>
    </mx:columns>
</mx:AdvancedDataGrid>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文