Slightly more efficient link display in datagrid; treat false and null titles as empty string

This commit is contained in:
Nathan Gray 2012-03-12 22:32:13 +00:00
parent 91c4a4de81
commit f26822c302

View File

@ -685,6 +685,7 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], {
* Used as a callback, so node is provided to make sure we get the right one * Used as a callback, so node is provided to make sure we get the right one
*/ */
set_title: function(node, _value) { set_title: function(node, _value) {
if(_value === false || _value === null) _value = "";
jQuery(node).text(_value+""); jQuery(node).text(_value+"");
}, },
@ -717,8 +718,16 @@ var et2_link = et2_valueWidget.extend([et2_IDetachedDOM], {
*/ */
setDetachedAttributes: function(_nodes, _values) { setDetachedAttributes: function(_nodes, _values) {
this.link = $j(_nodes[0]); this.link = $j(_nodes[0]);
if(typeof _values["value"] !== "undefined" && typeof _values["value"].title !== "undefined")
{
// Direct route
this.set_title(_nodes[0], _values["value"].title);
}
else
{
this.set_value(_values["value"]); this.set_value(_values["value"]);
} }
}
}); });
et2_register_widget(et2_link, ["link", "link-entry_ro"]); et2_register_widget(et2_link, ["link", "link-entry_ro"]);