allow additions to ListBar while it is detached. see #148.
This commit is contained in:
parent
89f54e3be4
commit
b53835c147
|
@ -298,6 +298,17 @@ Listbar.prototype.select = function(offset) {
|
||||||
offset = this.items.indexOf(offset);
|
offset = this.items.indexOf(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (offset < 0) {
|
||||||
|
offset = 0;
|
||||||
|
} else if (offset >= this.items.length) {
|
||||||
|
offset = this.items.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.parent) {
|
||||||
|
this.emit('select item', el, offset);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var lpos = this._getCoords();
|
var lpos = this._getCoords();
|
||||||
if (!lpos) return;
|
if (!lpos) return;
|
||||||
|
|
||||||
|
@ -307,12 +318,6 @@ Listbar.prototype.select = function(offset) {
|
||||||
, visible = 0
|
, visible = 0
|
||||||
, el;
|
, el;
|
||||||
|
|
||||||
if (offset < 0) {
|
|
||||||
offset = 0;
|
|
||||||
} else if (offset >= this.items.length) {
|
|
||||||
offset = this.items.length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
el = this.items[offset];
|
el = this.items[offset];
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue