ListStore remove(M model) does not update private data member "debugKeys"
Version(s) of Ext GWT
ListStore's method remove(M model) removes regardless of the being in allItems or visibleItems. BUT in the case of the model being in allItems only "debugKeys" is not updated causing false duplicate detection.
Steps to reproduce the problem
Create a liststore
Add model to liststore
Filter the liststore to exclude model
I expect the remove method to always update the debugKeys so that the internal lists and debugKeys are in-sync.
deubgKeys is not being updated causing a false duplicate detection error
* Entry point classes define <code>onModuleLoad()</code>.
public class GXTSandBox implements EntryPoint
* This is the entry point method.
public void onModuleLoad ()
ListStore<TestModel> store = new ListStore<TestModel>(
public String getKey (TestModel item)
TestModel testModel = new TestModel("testModel");
* Removes the given item, visible or not, from the store.
* @param model model to remove
* @return true if item was removed
public boolean remove (M model)
if (null == remove(indexOf(model)))
boolean result = allItems.remove(model);
Thanks for the report. The thinking had been that ListStore.remove(M) doesn't need to update debugKeys, since the first thing it does is to call ListStore.remove(int) which *does* remove that key, but clearly that doesn't work when filtered, since invisible items don't report an index, so the item gets lost.
I've filed this internally, and will update this thread when we have a fix tested and committed.
Thanks once again for the report - this has been fixed in SVN and the nightly builds, and will be available in the next release. The fix turned out to be slightly simpler - just removing the items from debugKeys if the existing if block is executed. This means that the items were not removed from the visible items, so still need to be a) removed from debugKeys (if not null) and b) removed from allItems.