#10474 closed defect (fixed)
ItemFileReadStore.getValues should use slice
Reported by: | Millennium | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | Data | Version: | 1.4.0b |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Today I was wondering the Reverse Reference Map wasn't set for an Item I inserted in the parent with the following code:
var tarRef = store.getValues(tarItem, "children"); tarRef.splice(tarRef.length - 1, 0, item) store.setValues(tarItem, "children", tarRef);
Because the ItemFileReadStore? uses getValues in his _setValueOrValue function. (Which I altered to the new situation with the above splice code.) And so the following Itemfilewritestore code fails to update the RRM.
var map = {}; dojo.forEach(oldValues, function(possibleItem){ if(this.isItem(possibleItem)){ var id = this.getIdentity(possibleItem); map[id.toString()] = true; } }, this); dojo.forEach(newValueArray, function(possibleItem){ if(this.isItem(possibleItem)){ var id = this.getIdentity(possibleItem); if(map[id.toString()]){ delete map[id.toString()]; }else{ this._addReferenceToMap(possibleItem, item, attribute); } } }, this); for(var rId in map){ var removedItem; if(this._itemsByIdentity){ removedItem = this._itemsByIdentity[rId]; }else{ removedItem = this._arrayOfAllItems[rId]; } this._removeReferenceFromMap(removedItem, item, attribute); }
Because OldValues? and New Values are the same array pointer....
Change History (6)
comment:1 Changed 11 years ago by
Component: | General → Data |
---|---|
Owner: | changed from anonymous to Jared Jurkiewicz |
comment:2 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 Changed 11 years ago by
[20990] broke dojox/data/demos/demo_LazyLoad.html
Open the demo page then click on "North America", then "Mexico" or "Canada", the children aren't loaded.
Any ideas?
Thanks!
comment:6 Changed 11 years ago by
Note: See
TracTickets for help on using
tickets.
(In [20989]) Committing in minor tweak. fixes #10474 \!strict