Browse Source

Pull request #1968: 无JIRA任务 null值显示成空

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit 'a66971d49535db1683dbada63816484c966f805f':
  null值显示成空
es6
guy 4 years ago
parent
commit
1611ad4d89
  1. 14
      src/case/ztree/0.treeview.js
  2. 8
      src/widget/multiselect/trigger/searcher.multiselect.insert.js
  3. 10
      src/widget/multiselect/trigger/searcher.multiselect.js
  4. 4
      src/widget/multitree/trigger/searcher.list.multi.tree.js
  5. 8
      src/widget/multitree/trigger/searcher.multi.tree.js

14
src/case/ztree/0.treeview.js

@ -95,7 +95,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
expandSpeed: "", expandSpeed: "",
nameIsHTML: true, // 节点可以用html标签代替 nameIsHTML: true, // 节点可以用html标签代替
dblClickExpand: false, dblClickExpand: false,
showLine: o.showLine, showLine: o.showLine
}, },
callback: { callback: {
beforeExpand: beforeExpand, beforeExpand: beforeExpand,
@ -238,7 +238,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
_getNodeValue: function (node) { _getNodeValue: function (node) {
// 去除标红 // 去除标红
return node.value == null ? BI.replaceAll(node.text.replace(/<[^>]+>/g, ""), "&nbsp;", " ") : node.value; return BI.isUndefined(node.value) ? BI.replaceAll(node.text.replace(/<[^>]+>/g, ""), "&nbsp;", " ") : node.value;
}, },
// 获取半选框值 // 获取半选框值
@ -338,10 +338,14 @@ BI.TreeView = BI.inherit(BI.Pane, {
n.isParent = n.isParent || n.parent; n.isParent = n.isParent || n.parent;
n.value = BI.isUndefined(n.value) ? n.text : n.value; n.value = BI.isUndefined(n.value) ? n.text : n.value;
// 处理标红 // 处理标红
if (BI.isKey(o.paras.keyword)) { if (BI.isNotNull(n.text)) {
n.text = BI.$("<div>").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); if (BI.isKey(o.paras.keyword)) {
n.text = BI.$("<div>").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html();
} else {
n.text = BI.htmlEncode(BI.Text.formatText(n.text + ""));
}
} else { } else {
n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); n.text = "";
} }
}); });
return nodes; return nodes;

8
src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -135,9 +135,9 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.assist, function (i, v) { BI.each(ob.assist, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v); state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (o.valueFormatter(v + "") || v); state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);
@ -151,9 +151,9 @@ BI.MultiSelectInsertSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v); state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (o.valueFormatter(v + "") || v); state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);

10
src/widget/multiselect/trigger/searcher.multiselect.js

@ -133,9 +133,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.assist, function (i, v) { BI.each(ob.assist, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v); state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (o.valueFormatter(v + "") || v); state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);
@ -149,9 +149,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
var state = ""; var state = "";
BI.each(ob.value, function (i, v) { BI.each(ob.value, function (i, v) {
if (i === 0) { if (i === 0) {
state += "" + (o.valueFormatter(v + "") || v); state += "" + (v === null ? "" : (o.valueFormatter(v + "") || v));
} else { } else {
state += "," + (o.valueFormatter(v + "") || v); state += "," + (v === null ? "" : (o.valueFormatter(v + "") || v));
} }
}); });
this.editor.setState(state); this.editor.setState(state);
@ -161,7 +161,7 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, {
} }
}, },
getState: function() { getState: function () {
return this.editor.getState(); return this.editor.getState();
}, },

4
src/widget/multitree/trigger/searcher.list.multi.tree.js

@ -122,7 +122,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, {
var text = ""; var text = "";
BI.each(ob.value, function (idx, path) { BI.each(ob.value, function (idx, path) {
var childValue = BI.last(path); var childValue = BI.last(path);
text += (o.valueFormatter(childValue + "") || childValue) + "; "; text += (path === "null" ? "" : (o.valueFormatter(childValue + "") || childValue) + "; ");
count++; count++;
}); });
@ -134,7 +134,7 @@ BI.MultiListTreeSearcher = BI.inherit(BI.Widget, {
} }
}, },
getState: function() { getState: function () {
return this.editor.getState(); return this.editor.getState();
}, },

8
src/widget/multitree/trigger/searcher.multi.tree.js

@ -16,7 +16,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
popup: {}, popup: {},
adapter: null, adapter: null,
masker: {}, masker: {}
}); });
}, },
@ -136,7 +136,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
var names = BI.Func.getSortedResult(BI.keys(value)); var names = BI.Func.getSortedResult(BI.keys(value));
BI.each(names, function (idx, name) { BI.each(names, function (idx, name) {
var childNodes = getChildrenNode(value[name]); var childNodes = getChildrenNode(value[name]);
text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + "; "; text += (name === "null" ? "" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + "; ";
if (childNodes === "") { if (childNodes === "") {
count++; count++;
} }
@ -156,7 +156,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
BI.each(names, function (idx, name) { BI.each(names, function (idx, name) {
index++; index++;
var childNodes = getChildrenNode(ob[name]); var childNodes = getChildrenNode(ob[name]);
text += (o.valueFormatter(name + "") || name) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ","); text += (name === "null" ? "" : (o.valueFormatter(name + "") || name)) + (childNodes === "" ? "" : (":" + childNodes)) + (index === size ? "" : ",");
if (childNodes === "") { if (childNodes === "") {
count++; count++;
} }
@ -165,7 +165,7 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
} }
}, },
getState: function() { getState: function () {
return this.editor.getState(); return this.editor.getState();
}, },

Loading…
Cancel
Save