2 Replies Latest reply on Nov 16, 2010 2:42 AM by mumcs01

    arrayCollection.removeAll() causes a datagrid index error

    mumcs01 Level 1

      I have a data grid bound to an arraycollection. I want to be able to have button that clears the arraycollection and rebuilds it. I did this originally by:



      arraycollection.rebuild;  (rebuild os a class function to build up the database from an httpservice... Takes a few seconds.



      The problem is, its seems asyncronous activities are bitting me again. after the remove all,  --- sometimes -- the browser will throw a range exception (index of '0' is invalid as part of the ListView Class). This seems to be happening right after the removeAll(). I'm assuming this is because I have just deleted the dataprovider contents of my datagrid, and rebuild isn't done. Hence why this only fails 'sometimes'.


      I'm trying to perform a refresh on a button click, and as there is no good way of running a 'restart' application, and I can't reset the entire webpage via javascript for several reasons. i need a way of 'stopping' the datagrid reference to the arraycollection while the rebuild is occuring.


      Or maybe I"m over thinking this.   Any ideas?