datagridapache-royale

Apache Royale : issue with DataGrid Jewel on SDK 0.9.7


As I want to use new features of Apache Royale, I switch from SDK 0.9.6 to 0.9.7 #716 (JSOnly Nightly Build) downloaded today.

But when trying to use Jewel DataGrid, I have an js error:

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)

Here is test case :

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

I beleave I must add an bead or something like this ?

Could someone help me ?


Solution

  • Add missing <j:columns> tag surrounding DataGridColumn