[Dojo-interest] DataGrid with dojo.store.JsonRest reverts to old value
MindJuice
ken at mindjuice.net
Thu Nov 10 18:53:08 EST 2011
OK, so I've been debugging this I found that if I add the two indicated lines
to doApplyCellEdit, then the value does not revert.
I added these lines because I could not see anywhere that the DataGrid's
item data was updated during the "apply" operation.
I doubt this is the best or proper fix, so I would appreciate if anyone from
the dojo team could help me track this down.
doApplyCellEdit: function(inValue, inRowIndex, inAttrName){
this.store.fetchItemByIdentity({
identity: this._by_idx[inRowIndex].idty,
onItem: dojo.hitch(this, function(item){
var oldValue = this.store.getValue(item, inAttrName);
if(typeof oldValue == 'number'){
inValue = isNaN(inValue) ? inValue : parseFloat(inValue);
}else if(typeof oldValue == 'boolean'){
inValue = inValue == 'true' ? true : inValue == 'false' ? false :
inValue;
}else if(oldValue instanceof Date){
var asDate = new Date(inValue);
inValue = isNaN(asDate.getTime()) ? inValue : asDate;
}
this.store.setValue(item, inAttrName, inValue);
//**** THE FOLLOWING TWO LINES WERE ADDED ****
var data = this.getItem(inRowIndex);
data[inAttrName] = inValue;
this.onApplyCellEdit(inValue, inRowIndex, inAttrName);
})
});
},
Also, this code only works with a JsonRest store wrapped directly in an
ObjectStore. I still have the TypeError problem if I wrap the JsonStore
with a Cache/Memory object before wrapping that in an ObjectStore.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DataGrid-with-dojo-store-JsonRest-reverts-to-old-value-tp3495080p3498336.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
More information about the Dojo-interest
mailing list