-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Revert bug fix - Add revert option * if revert option value is true, activate the revert function(default value is false) append feature N.grid - Add revert option * if revert option value is true, activate the revert function(default value is false)
- Loading branch information
bbalganjjm
committed
Jan 27, 2015
1 parent
7fd93c0
commit d0d85d4
Showing
1 changed file
with
21 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*! | ||
* Natural-UI v0.8.2.2 | ||
* Natural-UI v0.8.2.3 | ||
* [email protected] | ||
* | ||
* Copyright 2014 KIM HWANG MAN | ||
|
@@ -8,7 +8,7 @@ | |
* Date: 2014-09-26T11:11Z | ||
*/ | ||
(function(window, $) { | ||
var version = "0.8.2.2"; | ||
var version = "0.8.2.3"; | ||
|
||
// N local variables | ||
$.fn.extend(N, { | ||
|
@@ -1307,8 +1307,9 @@ | |
addTop : false, | ||
fRules : null, | ||
vRules : null, | ||
extObj : null, // for N.grid, | ||
extRow : -1 // for N.grid | ||
extObj : null, // for N.grid | ||
extRow : -1, // for N.grid | ||
revert : false | ||
}; | ||
|
||
try { | ||
|
@@ -1331,7 +1332,9 @@ | |
} | ||
this.options.context.addClass("form__"); | ||
|
||
this.revertData = $.extend({}, this.options.data[this.options.row]); | ||
if(this.options.revert) { | ||
this.revertData = $.extend({}, this.options.data[this.options.row]); | ||
} | ||
|
||
this.options.context.instance("form", this); | ||
|
||
|
@@ -1364,6 +1367,9 @@ | |
} | ||
if(data !== undefined) { | ||
opts.data = data; | ||
if(opts.revert) { | ||
this.revertData = $.extend({}, data[row]); | ||
} | ||
} | ||
var this_ = this; | ||
var vals; | ||
|
@@ -1557,9 +1563,12 @@ | |
}, | ||
revert : function() { | ||
var opts = this.options; | ||
if(!opts.revert) { | ||
N.error("[N.form.revert]Can not revert. N.form's revert option value is false"); | ||
} | ||
opts.data[opts.row] = $.extend({}, this.revertData); | ||
N.ds.instance(opts.extObj !== null ? opts.extObj : this).notify(opts.extRow > -1 ? opts.extRow : opts.row); | ||
this.update(opts.row); | ||
N.ds.instance(opts.extObj !== null ? opts.extObj : this).notify(opts.extRow > -1 ? opts.extRow : opts.row); | ||
return this; | ||
}, | ||
validate : function() { | ||
|
@@ -1703,6 +1712,7 @@ | |
select : false, | ||
multiselect : false, | ||
hover : false, | ||
revert : false, | ||
createRowDelay : 1, | ||
scrollPaging : { | ||
idx : 0, | ||
|
@@ -1868,7 +1878,8 @@ | |
html: opts.html, | ||
validate : opts.validate, | ||
extObj : this_, | ||
extRow : i | ||
extRow : i, | ||
revert : opts.revert | ||
}).bind(); | ||
|
||
tbodyTempClone.show(delay, function() { | ||
|
@@ -1949,6 +1960,9 @@ | |
}, | ||
revert : function(row) { | ||
var opts = this.options; | ||
if(!opts.revert) { | ||
N.error("[N.form.revert]Can not revert. N.form's revert option value is false"); | ||
} | ||
if(row !== undefined) { | ||
opts.context.find("tbody:eq(" + String(row) + ")").instance("form").revert(); | ||
} else { | ||
|