2 Replies Latest reply on May 18, 2010 9:18 PM by Flex harUI

    Datagrid makeRowsAndColumns bug

    cxy3594

      Hi all:

           I use flex 4 beta2.

          In my program I add a combobox editor on a datagrid column, and set the datagrid's lockedColumnCount=2. When I click the column, it will show the combobox , click the combobox , it will show the listmenu. After this I click other place, the editor should be hided, but in my programe it alert one flash error:

      TypeError: Error #1009: at mx.controls::DataGrid/makeRowsAndColumns()[E:\dev\gumbo_beta2\frameworks\projects\framewo rk\src\mx\controls\DataGrid.as:1830]
      at mx.controls.listClasses::ListBase/makeRowsAndColumnsWithExtraRows()[E:\dev\gumbo_beta2\fr ameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:1750]
      at mx.controls.listClasses::ListBase/updateDisplayList()[E:\dev\gumbo_beta2\frameworks\proje cts\framework\src\mx\controls\listClasses\ListBase.as:4387]
      at mx.controls.dataGridClasses::DataGridBase/updateDisplayList()[E:\dev\gumbo_beta2\framewor ks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:676]
      at mx.controls::DataGrid/updateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\framewor k\src\mx\controls\DataGrid.as:1716]
      at mx.controls.listClasses::ListBase/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\pro jects\framework\src\mx\controls\listClasses\ListBase.as:3969]
      at mx.managers::LayoutManager/validateDisplayList()[E:\dev\gumbo_beta2\frameworks\projects\f ramework\src\mx\managers\LayoutManager.as:663]
      at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects \framework\src\mx\managers\LayoutManager.as:736]
      at mx.managers::LayoutManager/validateNow()[E:\dev\gumbo_beta2\frameworks\projects\framework \src\mx\managers\LayoutManager.as:794]
      at mx.controls::ComboBox/displayDropdown()[E:\dev\gumbo_beta2\frameworks\projects\framework\ src\mx\controls\ComboBox.as:1849]
      at mx.controls::ComboBox/destroyDropdown()[E:\dev\gumbo_beta2\frameworks\projects\framework\ src\mx\controls\ComboBox.as:1894]
      at mx.controls::ComboBox/removedFromStageHandler()[E:\dev\gumbo_beta2\frameworks\projects\fr amework\src\mx\controls\ComboBox.as:2237]
      at flash.display::DisplayObjectContainer/removeChild()
      at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$removeChild()[E:\dev\gumbo_beta2\frameworks\p rojects\framework\src\mx\core\UIComponent.as:6577]
      at mx.core::UIComponent/removeChild()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\m x\core\UIComponent.as:6485]
      at mx.controls::DataGrid/destroyItemEditor()[E:\dev\gumbo_beta2\frameworks\projects\framewor k\src\mx\controls\DataGrid.as:4390]
      at mx.controls::DataGrid/itemEditorItemEditEndHandler()[E:\dev\gumbo_beta2\frameworks\projec ts\framework\src\mx\controls\DataGrid.as:5312]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()[E:\dev\gumbo_beta2\frameworks\projects\framework\src \mx\core\UIComponent.as:11749]
      at mx.controls::DataGrid/endEdit()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\c ontrols\DataGrid.as:4440]
      at mx.controls::DataGrid/mouseDownHandler()[E:\dev\gumbo_beta2\frameworks\projects\framework \src\mx\controls\DataGrid.as:4707]

       

      I found in Datagrid line 1823 ,it is:

      if (lockedColumnCount && editedItemPosition.columnIndex && visibleLockedColumns[lockedColumnCount - 1].colNum)
                      col = visibleLockedColumns[actualColIndex];
                  else
                      col = visibleColumns[actualColIndex];

      In my program editedItemPosition.columnIndex=4 and lockedColumnCount=2,actualColIndex=2, so this if condition will get true and col will be visibleLockedColumns[actualColIndex],but visibleLockedColumns only have tow items so the col will be null.

      In line 1830 in Datagrid the code is :

      if (item && !col.rendererIsEditor)

      It will call the col.rendererIsEditor, but the col is null, so the programe alert one error.

      I think the code in Datagrid 1823 should be "if (lockedColumnCount && editedItemPosition.columnIndex && visibleLockedColumns[lockedColumnCount - 1].colNum) && editedItemPosition.columnIndex<lockedColumnCount" .

      Is this a flex's bug?