jsharmony 1.26.0 → 1.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,11 @@ exports = module.exports = function(jsh){
25
25
 
26
26
  var XExtXModel = function(){ };
27
27
 
28
+ function getPreviousValue(xdata, id){
29
+ if(!xdata || !xdata._previous_values) return undefined;
30
+ return xdata._previous_values[id];
31
+ }
32
+
28
33
  function setPreviousValue(xdata, id, val){
29
34
  if(!xdata) return;
30
35
  if(!xdata._previous_values) xdata._previous_values = {};
@@ -362,10 +367,7 @@ exports = module.exports = function(jsh){
362
367
  }
363
368
  }
364
369
  var xform = jsh.XExt.getFormFromObject(obj);
365
- var oldval = undefined;
366
- if(xform && xform.Data && xform.Data._previous_values){
367
- if(id in xform.Data._previous_values) oldval = xform.Data._previous_values[id];
368
- }
370
+ var oldval = getPreviousValue(xform && xform.Data, id);
369
371
  var newval = _this.GetValue(field);
370
372
  var firedUndo = false;
371
373
  var xmodel = jsh.XModels[modelid];
package/clientjs/XForm.js CHANGED
@@ -223,6 +223,7 @@ exports = module.exports = function(jsh){
223
223
  var rslt = new this.DataType();
224
224
  rslt._is_insert = true;
225
225
  rslt._is_dirty = true;
226
+ rslt._previous_values = {};
226
227
  rslt = this.ApplyDefaults(rslt);
227
228
  this.ApplyUnboundDefaults(rslt);
228
229
  if(!options.unbound){
@@ -265,10 +266,11 @@ exports = module.exports = function(jsh){
265
266
  if(_.isArray(rslt[_this.modelid])){
266
267
  _this.DataSet = rslt[_this.modelid];
267
268
  for (var i = 0; i < _this.DataSet.length; i++) {
268
- _this.DataSet[i]['_is_insert'] = false;
269
- _this.DataSet[i]['_is_dirty'] = false;
270
- _this.DataSet[i]['_is_deleted'] = false;
271
- _this.DataSet[i]['_orig'] = null;
269
+ _this.DataSet[i]._is_insert = false;
270
+ _this.DataSet[i]._is_dirty = false;
271
+ _this.DataSet[i]._is_deleted = false;
272
+ _this.DataSet[i]._previous_values = {};
273
+ _this.DataSet[i]._orig = null;
272
274
  _this.ApplyUnboundDefaults(_this.DataSet[i]);
273
275
  }
274
276
  _this.DeleteSet = [];
@@ -287,6 +289,7 @@ exports = module.exports = function(jsh){
287
289
  _this.Data._is_insert = false;
288
290
  _this.Data._is_dirty = false;
289
291
  _this.Data._is_deleted = false;
292
+ _this.Data._previous_values = {};
290
293
  _this.Data._orig = null;
291
294
  _this.ApplyUnboundDefaults(_this.Data);
292
295
  }
@@ -314,6 +317,7 @@ exports = module.exports = function(jsh){
314
317
  if(this.Data._orig) this.Data = _.extend(this.Data, this.Data._orig);
315
318
  this.Data._orig = null;
316
319
  this.Data._is_dirty = false;
320
+ this.Data._previous_values = {};
317
321
  }
318
322
  if(this.DataSet){
319
323
  for(var i=0;i<this.DataSet.length;i++){
@@ -322,6 +326,7 @@ exports = module.exports = function(jsh){
322
326
  row._orig = null;
323
327
  row._is_dirty = false;
324
328
  row._is_deleted = false;
329
+ row._previous_values = {};
325
330
  if(row._is_insert){
326
331
  this.DataSet.splice(i,1);
327
332
  i--;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsharmony",
3
- "version": "1.26.0",
3
+ "version": "1.26.1",
4
4
  "description": "Rapid Application Development (RAD) Platform for Node.js Database Application Development",
5
5
  "main": "index.js",
6
6
  "scripts": {