增加Boolean类型数据支持
This commit is contained in:
parent
431bf4b3ed
commit
08c803b872
|
@ -14,7 +14,7 @@
|
||||||
ctl.val(value[name]);
|
ctl.val(value[name]);
|
||||||
if (ctl.attr('data-toggle') == "dropdown") {
|
if (ctl.attr('data-toggle') == "dropdown") {
|
||||||
var val = value[name];
|
var val = value[name];
|
||||||
if (!val) val = ctl.attr('data-default-val');
|
if ((typeof val == "string" && val == "") || val == undefined) val = ctl.attr('data-default-val');
|
||||||
ctl.children(':first').text(ctl.next().find('[data-val="' + val + '"]').text());
|
ctl.children(':first').text(ctl.next().find('[data-val="' + val + '"]').text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,10 @@
|
||||||
for (name in this.options.map) {
|
for (name in this.options.map) {
|
||||||
var ctl = $("#" + this.options.map[name]);
|
var ctl = $("#" + this.options.map[name]);
|
||||||
var dv = ctl.attr('data-default-val');
|
var dv = ctl.attr('data-default-val');
|
||||||
if (dv !== undefined && ctl.val().trim() === "") target[name] = dv;
|
if (dv != undefined && ctl.val() == "") target[name] = dv;
|
||||||
else target[name] = ctl.val();
|
else target[name] = ctl.val();
|
||||||
|
if (target[name] == "true" || target[name] == "True") target[name] = true;
|
||||||
|
if (target[name] == "false" || target[name] == "False") target[name] = false;
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue