BootstrapAdmin/Bootstrap.Admin/Content/js/longbow.dataentity.js

29 lines
851 B
JavaScript

(function ($) {
DataEntity = function (options) {
this.options = $.extend({ map: {} }, options);
};
DataEntity.VERSION = "1.0";
DataEntity.Author = "Argo Zhang";
DataEntity.Email = "argo@163.com";
DataEntity.prototype = {
load: function (value) {
for (name in this.options.map) {
$("#" + this.options.map[name]).val(value[name]);
}
},
reset: function () {
for (name in this.options.map) {
$("#" + this.options.map[name]).val("");
}
},
get: function () {
var target = {};
for (name in this.options.map) {
target[name] = $("#" + this.options.map[name]).val();
}
return target;
}
}
}(jQuery));