add item to ritems on appendItem.

This commit is contained in:
Christopher Jeffrey 2014-01-16 15:02:04 -06:00
parent eae9fb5fbd
commit 03e4d0d52b

View File

@ -4149,6 +4149,8 @@ List.prototype.addItem =
List.prototype.appendItem = function(item) {
var self = this;
this.ritems.push(item);
// Note: Could potentially use Button here.
var options = {
screen: this.screen,
@ -4224,8 +4226,6 @@ List.prototype.setItems = function(items) {
//, selected = this.selected
, sel = this.ritems[this.selected];
this.ritems = items;
this.select(0);
for (; i < items.length; i++) {
@ -4240,6 +4240,8 @@ List.prototype.setItems = function(items) {
this.remove(original[i]);
}
this.ritems = items;
// Try to find our old item if it still exists.
sel = items.indexOf(sel);
if (~sel) this.select(sel);