I recently needed to notify a DataCollection about changes on its elements originated on the server, not the client. On the java back end I generated a ChangeObtect with the information about the element and pushed the ChangeObject list to the client sending a message to the DataCollection's consumer destination.
The ChangeObject list arrived to the DataCollection, even when the changes were not originated on the client the changes were succesfully applied. The method responsible for applying the changes, "processChange" uses the method "find" to locate the element coming in the ChangeObject in the collection, but if the element we are looking for is hiden because a filter function was applied, the method "find" returns -1 and the element is added to the collection rather than being modified.
It wouldn't be better if the find method iterates over the source array of the DataCollection instead of the current collection view.
I have checked in the modified DataCollection. Method find(item) has now two arguments find(item,ignoreFilter=false). If one is using find(item, true) find will perform search through dataCollection.list, as oppose to dataCollection itself.
Consequently, processChange() is using notation find(item, true).
Please let me know the results.
Thank you very much Victor. Now all is working fine.
BTW, with the new changes I think ClearToolkit deserves it's own book.
The following line in method find in DataCollection provokes stack overflow when
var list:IList = ignoreFilter? list = this.list : list=this;
this one fixes the problem
var list:IList = ignoreFilter? this.list : this;