Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4394 closed defect (fixed)

ItemFileWriteStore save() is not functional

Reported by: guest Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.0
Component: Data Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

The saving functions defined inside save() use this pointer. I think the pointer should be copied, as the functions do not clearly set the correct attributes in the ItemFileWriteStore?, and have to be set manually outside save(). An example in save():

		var saveCompleteCallback = function(){
			this._pending = {
				_newItems:{}, 
				_modifiedItems:{},
				_deletedItems:{}
			};
			this._saveInProgress = false; // must come after this._pending is cleared, but before any callbacks
			if(keywordArgs && keywordArgs.onComplete){
				var scope = keywordArgs.scope || dojo.global;
				keywordArgs.onComplete.call(scope);
			}
		};

Should perhaps be:

                var _this = this;
		var saveCompleteCallback = function(){
			_this._pending = {
				_newItems:{}, 
				_modifiedItems:{},
				_deletedItems:{}
			};
			_this._saveInProgress = false; // must come after this._pending is cleared, but before any callbacks
			if(keywordArgs && keywordArgs.onComplete){
				var scope = keywordArgs.scope || dojo.global;
				keywordArgs.onComplete.call(scope);
			}
		};

Because this._pending and this._saveInProgress are not set correctly now.

Attachments (2)

dojo.data.ItemFileWriteStore.patch (2.2 KB) - added by Jared Jurkiewicz 12 years ago.
dojo.data.ItemFileWriteStore_20070927.patch (469 bytes) - added by Jared Jurkiewicz 12 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by skinner

Component: GeneralData
Owner: changed from anonymous to Jared Jurkiewicz

comment:2 Changed 12 years ago by Jared Jurkiewicz

Milestone: 1.0
Status: newassigned

Changed 12 years ago by Jared Jurkiewicz

comment:3 Changed 12 years ago by Jared Jurkiewicz

Resolution: fixed
Status: assignedclosed

(In [10483]) Minor fix to save. fixes #4394

comment:4 Changed 12 years ago by Jared Jurkiewicz

Tested on: FireFox? 2.0.0.4 IE 6 Safari B3.

Changed 12 years ago by Jared Jurkiewicz

comment:5 Changed 12 years ago by Jared Jurkiewicz

(In [10628]) Another minor ref fix. refs #4394

Note: See TracTickets for help on using tickets.