Browse Source

null值显示成空

es6
guy 3 years ago
parent
commit
a66971d495
  1. 8
      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

8
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,11 +338,15 @@ 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.isNotNull(n.text)) {
if (BI.isKey(o.paras.keyword)) { if (BI.isKey(o.paras.keyword)) {
n.text = BI.$("<div>").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); n.text = BI.$("<div>").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html();
} else { } else {
n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); n.text = BI.htmlEncode(BI.Text.formatText(n.text + ""));
} }
} else {
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