5 Replies Latest reply on Nov 4, 2011 11:05 AM by pedro.oliva

    Error when a DataGrid is edited

    ComboDrums

      Hi,

       

      I set my app DataGrid to editable to true. But when I double click to edit a cell, a Flash Player error occur :

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at spark.accessibility::DataGridAccImpl/makeRowString()[E:\dev\4.5.1\frameworks\projects\spa rk\src\spark\accessibility\DataGridAccImpl.as:1068]
          at spark.accessibility::DataGridAccImpl/eventHandler()[E:\dev\4.5.1\frameworks\projects\spar k\src\spark\accessibility\DataGridAccImpl.as:1031]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]
          at spark.components.gridClasses::DataGridEditor/setEditedItemPosition()[E:\dev\4.5.1\framewo rks\projects\spark\src\spark\components\gridClasses\DataGridEditor.as:315]
          at spark.components.gridClasses::DataGridEditor/dataGrid_gridItemEditorSessionStartingHandle r()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\gridClasses\DataGridEditor .as:1204]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]
          at spark.components.gridClasses::DataGridEditor/startItemEditorSession()[E:\dev\4.5.1\framew orks\projects\spark\src\spark\components\gridClasses\DataGridEditor.as:798]
          at spark.components::DataGrid/startItemEditorSession()[E:\dev\4.5.1\frameworks\projects\spar k\src\spark\components\DataGrid.as:3803]
          at spark.components.gridClasses::DataGridEditor/grid_gridMouseUpHandler()[E:\dev\4.5.1\frame works\projects\spark\src\spark\components\gridClasses\DataGridEditor.as:1379]
          at flash.events::EventDispatcher/dispatchEventFunction()
          at flash.events::EventDispatcher/dispatchEvent()
          at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]
          at spark.components::Grid/dispatchGridEvent()[E:\dev\4.5.1\frameworks\projects\spark\src\spa rk\components\Grid.as:4038]
          at spark.components::Grid/grid_mouseDownDragUpHandler()[E:\dev\4.5.1\frameworks\projects\spa rk\src\spark\components\Grid.as:3883]
          at Function/<anonymous>()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\utils\MouseEventU til.as:96]

      I tried to put the DataGrid in a very simple new project and there is no error.

       

      Here is the code :

      <s:DataGrid id="dgProperties" width="100%" height="100%" editable="true"
              sortableColumns="false">
              <s:ArrayCollection>
                      <s:DataItem key="1000" name="Abrasive" price="100.11" call="false"/>
                      <s:DataItem key="1001" name="Brush" price="110.01" call="true"/>
                      <s:DataItem key="1002" name="Clamp" price="120.02" call="false"/>
                      <s:DataItem key="1003" name="Drill" price="130.03" call="true"/>
                      <s:DataItem key="1004" name="Epoxy" price="140.04" call="false"/>
                      <s:DataItem key="1005" name="File" price="150.05" call="true"/>
                      <s:DataItem key="1006" name="Gouge" price="160.06" call="false"/>
                      <s:DataItem key="1007" name="Hook" price="170.07" call="true"/>
                      <s:DataItem key="1008" name="Ink" price="180.08" call="false"/>
                      <s:DataItem key="1009" name="Jack" price="190.09" call="true"/>            
                  </s:ArrayCollection>
              <s:columns>
                 
                  <s:ArrayList>
                      <s:GridColumn headerText="name" dataField="name"/>
                      <s:GridColumn headerText="price" dataField="price"/>
                  </s:ArrayList>
              </s:columns>
             
          </s:DataGrid>

      Thx.

        • 1. Re: Error when a DataGrid is edited
          Flex harUI Adobe Employee

          Debug into it and see what is null.  Maybe the resources for your locale are

          incomplete?

          • 2. Re: Error when a DataGrid is edited
            ComboDrums Level 1

            Thx for your help. I found the bug but i don't know how to fix it.

             

            I use ResourceManager.getInstance().localeChain = ["fr"] to set the ApplicationUpdaterUI to french language. But after that, all my Alert show "null" in buttons label. If I comment this code, everything is OK.

             

            What is the problem?

             

            Thx.

            • 3. Re: Error when a DataGrid is edited
              fleRavix Level 2

              Hi ,

               

              I suggest you to use the ResourceManager.getInstance().localeChain = ["fr"]  in a callLater() method.

              and then use this callLater in your app init()(or whereever u require)

              THis ensures that you are having all the references loaded on to the displayList

               

              problem is u r calling ResourceManager.getInstance().localeChain = ["fr"]  before the ResourceManger class is initialized

              • 4. Re: Error when a DataGrid is edited
                pedro.oliva

                I have same problem.

                 

                TypeError: Error #1009: Cannot access a property or method of a null object reference.

                    at spark.accessibility::DataGridAccImpl/makeRowString()[E:\dev\4.5.1\frameworks\projects\spa rk\src\spark\accessibility\DataGridAccImpl.as:1068]

                    at spark.accessibility::DataGridAccImpl/eventHandler()[E:\dev\4.5.1\frameworks\projects\spar k\src\spark\accessibility\DataGridAccImpl.as:1031]

                    at flash.events::EventDispatcher/dispatchEventFunction()

                    at flash.events::EventDispatcher/dispatchEvent()

                    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]

                    at spark.components.gridClasses::DataGridEditor/setEditedItemPosition()[E:\dev\4.5.1\framewo rks\projects\spark\src\spark\components\gridClasses\DataGridEditor.as:315]

                    at spark.components.gridClasses::DataGridEditor/dataGrid_gridItemEditorSessionStartingHandle r()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\gridClasses\DataGridEditor .as:1204]

                    at flash.events::EventDispatcher/dispatchEventFunction()

                    at flash.events::EventDispatcher/dispatchEvent()

                    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]

                    at spark.components.gridClasses::DataGridEditor/startItemEditorSession()[E:\dev\4.5.1\framew orks\projects\spark\src\spark\components\gridClasses\DataGridEditor.as:798]

                    at spark.components::DataGrid/startItemEditorSession()[E:\dev\4.5.1\frameworks\projects\spar k\src\spark\components\DataGrid.as:3803]

                    at spark.components.gridClasses::DataGridEditor/doubleClickTimerHandler()[E:\dev\4.5.1\frame works\projects\spark\src\spark\components\gridClasses\DataGridEditor.as:1428]

                    at flash.utils::Timer/_timerDispatch()

                    at flash.utils::Timer/tick()

                 

                In the class DataGridAccImpl, line 1068: "rowString = rowString.replace("%1", dgAccInfo.reachableRowIndex + 1).replace("%2", dgAccInfo.reachableRowCount);". rowString is null.

                After app initialized i call ResourceManager.getInstance().localeChain = [language]; (language = "fr_FR"). I tried "fr" "en_US" "pt_BR".. Same problem.

                This problem is only in AIR project.

                Anyone already solved this problem?

                • 5. Re: Error when a DataGrid is edited
                  pedro.oliva Level 1

                  Solved!

                  The problem was very simple. I used a file for ResourceBundle with the name of "components". The Flex has a specific file for that use. Renamed the aqruvid and it worked.