mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-20 09:58:04 +02:00
Get empty label / row count legacy option working
This commit is contained in:
parent
abf37487b8
commit
379b05b39f
@ -51,7 +51,6 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
this.input = null;
|
this.input = null;
|
||||||
this.id = "";
|
this.id = "";
|
||||||
|
|
||||||
if(this.rows > 1) this.multiselect=true;
|
|
||||||
this.createInputWidget();
|
this.createInputWidget();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -65,6 +64,13 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
} else {
|
} else {
|
||||||
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.rows == "string" && isNaN(this.rows)) {
|
||||||
|
this.set_empty_label(this.rows);
|
||||||
|
this.set_rows(1);
|
||||||
|
}
|
||||||
|
if(this.rows > 1) this.set_multiselect(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
createInputWidget: function() {
|
createInputWidget: function() {
|
||||||
@ -79,30 +85,34 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
this.setDOMNode(this.input[0]);
|
this.setDOMNode(this.input[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadingFinished: function() {
|
/**
|
||||||
|
* Override parent to get the select options.
|
||||||
|
* Can't get them before this, because the ID is not set when createInputWidget() is called.
|
||||||
|
*/
|
||||||
|
set_id: function() {
|
||||||
this._super.apply(this,arguments);
|
this._super.apply(this,arguments);
|
||||||
|
|
||||||
// Get select options from the manager(s)
|
// Get select options from the manager(s)
|
||||||
var options = null;
|
var options = null;
|
||||||
|
|
||||||
// Check the sel_options
|
// Check the sel_options (from managers)
|
||||||
var mgr = this.getArrayMgr('sel_options');
|
this.set_select_options(null);
|
||||||
if(mgr) {
|
|
||||||
options = mgr.getValueForID(this.id);
|
|
||||||
}
|
|
||||||
if(options != null) {
|
|
||||||
this.set_select_options(options);
|
|
||||||
} else {
|
|
||||||
// Check in the content
|
|
||||||
var mgr = this.getArrayMgr('content');
|
|
||||||
if(mgr) {
|
|
||||||
options = mgr.getValueForID('options-'+this.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.set_select_options(options);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
set_select_options: function(_options) {
|
set_select_options: function(_options) {
|
||||||
|
if(_options == null) {
|
||||||
|
var mgr = this.getArrayMgr('sel_options');
|
||||||
|
if(mgr) {
|
||||||
|
options = mgr.getValueForID(this.id);
|
||||||
|
}
|
||||||
|
if(options == null) {
|
||||||
|
// Check in the content
|
||||||
|
var mgr = this.getArrayMgr('content');
|
||||||
|
if(mgr) {
|
||||||
|
options = mgr.getValueForID('options-'+this.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
this.input.children().remove();
|
this.input.children().remove();
|
||||||
if(this.empty_label) {
|
if(this.empty_label) {
|
||||||
this.input.append("<option value=''" + ("" == this.getValue() ? "selected":"") +">"+this.empty_label+"</option>");
|
this.input.append("<option value=''" + ("" == this.getValue() ? "selected":"") +">"+this.empty_label+"</option>");
|
||||||
@ -130,6 +140,12 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
this.rows = _rows;
|
this.rows = _rows;
|
||||||
this.input.attr("size",this.rows);
|
this.input.attr("size",this.rows);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
set_empty_label: function(_label) {
|
||||||
|
if(_label != this.empty_label) {
|
||||||
|
this.empty_label = _label;
|
||||||
|
this.set_select_options(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user