@ -236,6 +236,7 @@ DataSet.prototype.add = function (data, senderId) {
DataSet.prototype.update=function(data,senderId){
DataSet.prototype.update=function(data,senderId){
varaddedIds=[];
varaddedIds=[];
varupdatedIds=[];
varupdatedIds=[];
varoldData=[];
varupdatedData=[];
varupdatedData=[];
varme=this;
varme=this;
varfieldId=me._fieldId;
varfieldId=me._fieldId;
@ -243,11 +244,12 @@ DataSet.prototype.update = function (data, senderId) {
varaddOrUpdate=function(item){
varaddOrUpdate=function(item){
varid=item[fieldId];
varid=item[fieldId];
if(me._data[id]){
if(me._data[id]){
varoldData=util.extend({},me._data[id]);
varoldItem=util.extend({},me._data[id]);
// update item
// update item
id=me._updateItem(item);
id=me._updateItem(item);
updatedIds.push(id);
updatedIds.push(id);
updatedData.push(oldData);
updatedData.push(item);
oldData.push(oldItem);
}
}
else{
else{
// add new item
// add new item
@ -274,14 +276,14 @@ DataSet.prototype.update = function (data, senderId) {
this._trigger('add',{items:addedIds},senderId);
this._trigger('add',{items:addedIds},senderId);
}
}
if(updatedIds.length){
if(updatedIds.length){
varprops={items:updatedIds,oldData:updatedData};
// TODO: remove deprecated property 'data' some day
Object.defineProperty(props,'data',{
'get':(function(){
console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
// TODO: remove deprecated property 'data' some day
//Object.defineProperty(props, 'data', {
// 'get': (function() {
// console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');