From 08c803b8729323b7490b3c34e274996ab34bed1c Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Mon, 13 Mar 2017 23:17:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Boolean=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Content/js/longbow.dataentity.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Bootstrap.Admin/Content/js/longbow.dataentity.js b/Bootstrap.Admin/Content/js/longbow.dataentity.js index 3b950b94..eaed6648 100644 --- a/Bootstrap.Admin/Content/js/longbow.dataentity.js +++ b/Bootstrap.Admin/Content/js/longbow.dataentity.js @@ -14,7 +14,7 @@ ctl.val(value[name]); if (ctl.attr('data-toggle') == "dropdown") { 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()); } } @@ -35,8 +35,10 @@ for (name in this.options.map) { var ctl = $("#" + this.options.map[name]); 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(); + if (target[name] == "true" || target[name] == "True") target[name] = true; + if (target[name] == "false" || target[name] == "False") target[name] = false; } return target; }