Hi Everyone,

I think I have solved this.

I started to create a test app to illustrate the issue, and I could
recreate the issue.

I noticed 2 things I was doing in my main project, that I was not
doing with my test app.

I was adding data to the ArrayCollection using addItemAt, in my test
app I simply used addItem.

I was handling the updateComplete event in the Datagrid trying to set
the selected Index and verticalScrollPosition.

I remove the updateComplete Event handler and changed the way data was
added to the ArrayCollection and voia the issue had disappeared.

I hope this might help someone in the future,

Mark


--- In [email protected], "mark_j_ellul" <[EMAIL PROTECTED]> wrote:
>
> HI,
> 
> I was wondering if anyone has come across this issue, or knows where I
> should start looking for a solution.
> 
> My project is as follows, I have a datagrid with an ArrayCollection as
> its dataprovider. I use a timer to check a web service every 5 seconds
> for new data, pulling a maximum of 40 rows of data at a time.
> 
> So I start my app, and when the first set is loaded up I start to
> scroll the datagrid to get to the bottom the loaded data. Then when
> the timer loads up the new data into the array collection, my Datagrid
> scrolls back to the top.
> 
> The issue is that when I then scroll down, I see there are rows
> between the first data that is loaded and the next that are blank. I
> edit the row data this via a DoubleClick as I do the editing in a pop
> up. When I try to edit one of these blank rows I receive errors, cos I
> pass in the caretBookmark to gain access to the object data in my
> ArrayCollection.
> 
> I also get errors such as below, when scrolling in the datagrid with
> the keyboard and mouse. 
> 
> Should I be calling something like itemUpdated in the ArrayCollection
> every time I add a new item or remove an item, so the Datagrid is
> notified explicitly?
> 
> Has anyone ever come across this error? 
> 
> Any ideas on what I should be looking at to solve this?
> 
> The blank rows seems very weird to say the least, I think maybe some
> internal counter which links the rows in the ArrayCollection and
> DataGrid rows must be going haywire?
> 
> Is there a way to avoid this error? For example to stop the Datagrid
> invalidating until the objects are added to the ArrayCollection and
> then call an invalidation type redraw?
> 
> Any help would be appreciated.
> 
> Regards
> 
> Mark
> 
> TypeError: Error #1010: A term is undefined and has no properties.
>       at
>
mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::scrollVertically()
>       at mx.controls::DataGrid/mx.controls:DataGrid::scrollVertically()
>       at mx.controls.listClasses::ListBase/set verticalScrollPosition()
>       at mx.controls::DataGrid/mx.controls:DataGrid::scrollHandler()
>       at
>
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
>       at flash.events::EventDispatcher/dispatchEvent()
>       at mx.core::UIComponent/dispatchEvent()
>       at
>
mx.controls.scrollClasses::ScrollBar/http://www.adobe.com/2006/flex/mx/internal::dispatchScrollEvent()
>       at mx.controls.scrollClasses::ScrollThumb/::mouseMoveHandler()
>


Reply via email to