Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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 9 years ago by bill

Component: GeneralData
Owner: changed from anonymous to Jared Jurkiewicz

comment:2 Changed 9 years ago by Jared Jurkiewicz

Milestone: tbd1.5

comment:3 Changed 9 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [20989]) Committing in minor tweak. fixes #10474 \!strict

comment:4 Changed 9 years ago by Jared Jurkiewicz

(In [20990]) Committing in minor tweak. refs #10474 \!strict

comment:5 Changed 9 years ago by nic

[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 9 years ago by Jared Jurkiewicz

(In [21043]) Fixing problem with lazy-load demo caused by change to use slice in getValues. refs #10474 \!strict

Note: See TracTickets for help on using tickets.