forked from extern/egroupware
Get empty_text option working for ro select-account
This commit is contained in:
parent
94cd19a50c
commit
dd913e89ab
@ -26,6 +26,17 @@
|
|||||||
*/
|
*/
|
||||||
var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], {
|
var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], {
|
||||||
|
|
||||||
|
attributes: {
|
||||||
|
"empty_label": {
|
||||||
|
"name": "Empty label",
|
||||||
|
"type": "string",
|
||||||
|
"default": "",
|
||||||
|
"description": "Textual label for first row, eg: 'All' or 'None'. ID will be ''"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
legacyOptions: ["empty_label"],
|
||||||
|
|
||||||
init: function(_parent, options) {
|
init: function(_parent, options) {
|
||||||
/**
|
/**
|
||||||
Resolve some circular dependency problems here
|
Resolve some circular dependency problems here
|
||||||
@ -39,6 +50,15 @@ var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], {
|
|||||||
|
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
// Legacy options could have row count or empty label in first slot
|
||||||
|
if(typeof this.options.empty_label == "string")
|
||||||
|
{
|
||||||
|
if(isNaN(this.options.empty_label))
|
||||||
|
{
|
||||||
|
this.options.empty_label = this.egw().lang(this.options.empty_label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.options.application = 'home-accounts';
|
this.options.application = 'home-accounts';
|
||||||
|
|
||||||
// Don't make it look like a link though
|
// Don't make it look like a link though
|
||||||
@ -50,6 +70,27 @@ var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], {
|
|||||||
|
|
||||||
// Don't make it look like a link though
|
// Don't make it look like a link though
|
||||||
jQuery('li',this.list).removeClass("et2_link et2_link_string");
|
jQuery('li',this.list).removeClass("et2_link et2_link_string");
|
||||||
|
|
||||||
|
// Empty label from selectbox
|
||||||
|
if(this.options.empty_label)
|
||||||
|
{
|
||||||
|
if(!_value)
|
||||||
|
{
|
||||||
|
this.list.append("<li>"+this.options.empty_label+"</li>");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// An array with 0 / empty in it?
|
||||||
|
for(var i = 0; i < _value.length; i++)
|
||||||
|
{
|
||||||
|
if(!_value[i] || !parseInt(_value[i]))
|
||||||
|
{
|
||||||
|
this.list.append("<li>"+this.options.empty_label+"</li>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
et2_register_widget(et2_selectAccount_ro, ["select-account_ro"]);
|
et2_register_widget(et2_selectAccount_ro, ["select-account_ro"]);
|
||||||
|
Loading…
Reference in New Issue
Block a user