automatically update dropdown label when setting items

pull/125/merge
nightwing 2017-04-11 15:49:57 +04:00
rodzic f349a97928
commit 6f2c99ae3e
2 zmienionych plików z 5 dodań i 16 usunięć

Wyświetl plik

@ -203,9 +203,7 @@ define(function(require, exports, module) {
value: options.path
? settings.get(options.path)
: (options.defaultValue || ""),
// each: options.each || "item",
caption: options.caption,
// eachvalue: options.eachvalue || "value",
"empty-message": options["empty-message"]
})
];
@ -458,16 +456,11 @@ define(function(require, exports, module) {
case "dropdown":
var dropdown = el.lastChild;
if (item.items) {
if (item.items)
dropdown.setChildren(item.items);
var value = item.value || dropdown.value;
dropdown.value = -999;
dropdown.setAttribute("value", value);
}
else if (item.value) {
if (item.value != null)
dropdown.setAttribute("value", item.value);
}
break;
default:
// supported attributes

Wyświetl plik

@ -328,6 +328,7 @@ apf.dropdown = function(struct, tagName) {
return;
}
}
this.$setLabel(String(value));
};
function isValueEqual(v1, v2) {
@ -469,7 +470,6 @@ apf.dropdown = function(struct, tagName) {
this.$setLabel = function(value) {
this.oLabel.innerHTML = value || this["initial-message"] || "";
this.$setStyleClass(this.$ext, value ? "" : this.$baseCSSname + "Initial",
!value ? [] : [this.$baseCSSname + "Initial"]);
};
@ -477,17 +477,12 @@ apf.dropdown = function(struct, tagName) {
// Private functions
this.$blur = function() {
this.slideUp();
//this.$ext.dispatchEvent("mouseout")
if (!this.isOpen)
this.$setStyleClass(this.$ext, "", [this.$baseCSSname + "Over"])
this.$setStyleClass(this.$ext, "", [this.$baseCSSname + "Over"]);
this.$setStyleClass(this.$ext, "", [this.$baseCSSname + "Focus"]);
};
/*this.$focus = function(){
apf.popup.forceHide();
this.$setStyleClass(this.oFocus || this.$ext, this.$baseCSSname + "Focus");
}*/
this.$setClearMessage = function(msg) {
this.$setLabel(msg);
@ -504,6 +499,7 @@ apf.dropdown = function(struct, tagName) {
this.items = data;
if (this.isOpen)
this.$updateChildren();
this.$propHandlers["value"].call(this, this.value);
};
this.change =