0

由于我想使用 Apache Royale 的新功能,我从 SDK 0.9.6 切换到今天下载的 0.9.7 #716 (JSOnly Nightly Build)。

但是在尝试使用 Jewel DataGrid 时,出现 js 错误:

DataGridView.js:171 Uncaught TypeError: Cannot read property 'length' of undefined
    at org.apache.royale.jewel.beads.views.DataGridView.handleDataProviderChanged (DataGridView.js:171)
    at org.apache.royale.jewel.beads.views.DataGridView.org_apache_royale_jewel_beads_views_DataGridView_createChildren (DataGridView.js:140)
    at org.apache.royale.jewel.beads.views.DataGridView.set__strand (DataGridView.js:308)
    at org.apache.royale.jewel.DataGrid.org.apache.royale.core.ElementWrapper.addBead (ElementWrapper.js:117)
    at org.apache.royale.jewel.DataGrid.org.apache.royale.core.HTMLElementWrapper.addBead (HTMLElementWrapper.js:50)
    at org.apache.royale.jewel.DataGrid.org.apache.royale.core.UIBase.addBead (UIBase.js:375)
    at Object.org.apache.royale.utils.loadBeadFromValuesManager (loadBeadFromValuesManager.js:41)
    at org.apache.royale.jewel.DataGrid.org.apache.royale.core.UIBase.addedToParent (UIBase.js:563)
    at org.apache.royale.jewel.DataGrid.org.apache.royale.jewel.supportClasses.group.GroupBase.addedToParent (GroupBase.js:64)
    at org.apache.royale.jewel.DataGrid.org.apache.royale.jewel.Group.addedToParent (Group.js:74)

这是测试用例:

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:js="library://ns.apache.org/royale/basic" 
                xmlns:j="library://ns.apache.org/royale/jewel" 
                applicationComplete="ev_complete()">

    <j:initialView>
        <j:View >
            <j:Label text="Hello"/>
            <j:DataGrid localId="dg" width="800" height="500">
               <j:beads>
                    <j:AddDataGridItemRendererForArrayListData/>
                    <j:RemoveDataGridItemRendererForArrayListData/>
                    <j:UpdateDataGridItemRendererForArrayListData/>
                    <j:RemoveAllDataGridItemRendererForArrayListData/>
                </j:beads>
                <j:DataGridColumn label="Label" dataField="label"/>
                <j:DataGridColumn label="D1" dataField="d1" />
            </j:DataGrid>
        </j:View>        
    </j:initialView>    

    <fx:Script>
        <![CDATA[   
            import org.apache.royale.collections.ArrayList;
            private function ev_complete():void{
                dg.dataProvider = new ArrayList([
                    {label:'label1', d1:'data1'},
                    {label:'label2', d1:'data2'},
                    {label:'label3', d1:'data3'}
                ])
            }
        ]]>
    </fx:Script>
</j:Application>

我相信我必须添加一个珠子或类似的东西?

有人可以帮助我吗?

4

1 回答 1

1

添加缺少的<j:columns>标签周围DataGridColumn

于 2020-01-30T15:18:41.783 回答