Opened 9 years ago

Closed 6 years ago

#10905 closed defect (wontfix)

Method isDirty returns undefined instead of false

Reported by: Simon Speich Owned by: Kris Zyp
Priority: high Milestone: tbd
Component: DojoX Data Version: 1.4.0
Keywords: JsonRestore Cc:
Blocked By: Blocking:

Description

When using the JsonRestStore?, the isDirty() method returns 'undefined' instead of 'false' before or after successfully calling deleteItem(). But this happens only when providing the item as an argument. When calling isDirty() without the argument the method correctly returns false, but only in case of HTTP 204.

But when the response from the server is HTTP 404, the method without argument now incorrectly returns false instead of true even after calling revert(), whereas with the item argument it always reports true (even after revert).

See debug and comment in code below:

deleteItem: function(item){
	var store = this.store;
	console.debug('before delete call (no item arg):' + store.isDirty()); // -> false
	console.debug('before delete call:' + store.isDirty(item)); // -> undefined
	store.deleteItem(item);
	console.debug('after delete call (no item arg):' + store.isDirty()); // -> true
	console.debug('after delete call:' + store.isDirty(item)); // -> true
	store.save({
		onComplete: function(item){
			console.debug('successfully deleted (no item arg):' + store.isDirty()); // -> false
			console.debug('successfully deleted:' + store.isDirty(item)); // -> undefined
			},
			onError: function(error){
				console.debug('error deleting (no item arg):' + store.isDirty()); // -> false
				console.debug('error deleting:' + store.isDirty(item)); // -> true
				store.revert();
				console.debug('reverted (no item arg):' + store.isDirty()); // -> false
				console.debug('reverted: ' + store.isDirty(item)); // -> true
			}
		});
	}

Change History (2)

comment:1 Changed 9 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to Kris Zyp

comment:2 Changed 6 years ago by Colin Snover

Resolution: wontfix
Status: newclosed

dojox/data is abandoned. Some dojox/data stores have been upgraded to use the Dojo Store API and can be found at https://github.com/kfranqueiro/dojo-smore.

Note: See TracTickets for help on using tickets.