0 Replies Latest reply on Jan 4, 2007 10:28 AM by michael_ramirez44

    itemRender on DataGrid column

    michael_ramirez44 Level 1
      I get a Run-Time Error #1010 on my datagrid control when I scroll vertically. The problem would not happen everytime so I was having a hard time fixing it. This is the exact error message I would get.

      TypeError: Error #1010: A term is undefined and has no properties.
      at mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::scrollVertically()[C: \dev\GMC\sdk\frameworks\mx\controls\listClasses\ListBase.as:5260]
      at mx.controls::DataGrid/mx.controls:DataGrid::scrollVertically()[C:\dev\GMC\sdk\frameworks\ mx\controls\DataGrid.as:1887]
      at mx.controls.listClasses::ListBase/set verticalScrollPosition()[C:\dev\GMC\sdk\frameworks\mx\controls\listClasses\ListBase.as:10 18]
      at mx.controls::DataGrid/mx.controls:DataGrid::scrollHandler()[C:\dev\GMC\sdk\frameworks\mx\ controls\DataGrid.as:1694]
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.controls.scrollClasses::ScrollBar/ http://www.adobe.com/2006/flex/mx/internal::dispatchScrollEvent()[C:\dev\GMC\sdk\framework s\mx\controls\scrollClasses\ScrollBar.as:1095
      at mx.controls.scrollClasses::ScrollBar/ http://www.adobe.com/2006/flex/mx/internal::pageScroll()[C:\dev\GMC\sdk\frameworks\mx\cont rols\scrollClasses\ScrollBar.as:1079
      at mx.controls.scrollClasses::ScrollBar/mx.controls.scrollClasses:ScrollBar::scrollTrack_mou seDownHandler()[C:\dev\GMC\sdk\frameworks\mx\controls\scrollClasses\ScrollBar.as:1215]

      I know now that my itemRenderer on my datagrid columns is causing this error. Depending on the columns return from my remote call I determine if a specific column is to use the item renderer.

      if( col.allowFilter )
      {
      trace("Execute ItemRenderer!");
      filterRenderer = new ClassFactory(ColumnFilterRenderer);
      filterRenderer.properties = {dataField: name };
      newColumn.itemRenderer = filterRenderer;
      newColumn.rendererIsEditor = true;
      }

      I looks like the datagrid gets confused and how many rows there are to renderer. I can reproduce the problem like so:

      1. I click on a node in a Tree control which loads 50 rows into my datagrid causing it to scroll vertically. I can scroll these results fine.
      2. I click on a node in a Tree control which loads more then 50 rows into my datagrid causing it to scroll vertically. If I try to scroll I get the run-time error.

      So I can reproduce the error only if I load a small result set that scrolls then load a larger result set that scrolls. If I load a large result set first then a smaller one I don't get the run-time error. If I load a small result set that scrolls then one that does not then a large one that does I don't get the error. I think the listItems variable in the ListBase class is getting confused on how many itemRenderers it needs to actually render.