that. -> self.

This commit is contained in:
rlx 2014-09-24 20:17:57 +02:00
parent 1520673ed3
commit f557733be6

View file

@ -31,17 +31,17 @@ Ox.InfoList = function(options, self) {
.options(options || {}) .options(options || {})
.update({ .update({
items: function() { items: function() {
that.$element.options({items: self.options.items}); self.$list.options({items: self.options.items});
}, },
query: function() { query: function() {
that.$element.options({query: self.options.query}); self.$list.options({query: self.options.query});
}, },
selected: function() { selected: function() {
that.$element.options({selected: self.options.selected}); self.$list.options({selected: self.options.selected});
}, },
sort: function() { sort: function() {
updateKeys(); updateKeys();
that.$element.options({sort: self.options.sort}); self.$list.options({sort: self.options.sort});
}, },
width: function() { width: function() {
// FIXME: don't use classname for this lookup // FIXME: don't use classname for this lookup
@ -61,7 +61,7 @@ Ox.InfoList = function(options, self) {
self.itemHeight = self.options.size; self.itemHeight = self.options.size;
that.setElement( that.setElement(
Ox.List({ self.$list = Ox.List({
construct: constructItem, construct: constructItem,
draggable: self.options.draggable, draggable: self.options.draggable,
id: self.options.id, id: self.options.id,
@ -167,16 +167,16 @@ Ox.InfoList = function(options, self) {
function getItemWidth(cached) { function getItemWidth(cached) {
if (!cached) { if (!cached) {
self.cachedWidth = that.$element.width() - Ox.UI.SCROLLBAR_SIZE; self.cachedWidth = self.$list.width() - Ox.UI.SCROLLBAR_SIZE;
} else if (!self.cachedWidth || self.cachedWidthTime < +new Date() - 5000) { } else if (!self.cachedWidth || self.cachedWidthTime < +new Date() - 5000) {
self.cachedWidth = that.$element.width() - Ox.UI.SCROLLBAR_SIZE; self.cachedWidth = self.$list.width() - Ox.UI.SCROLLBAR_SIZE;
self.cachedWidthTime = +new Date(); self.cachedWidthTime = +new Date();
} }
return self.cachedWidth; return self.cachedWidth;
} }
function updateKeys() { function updateKeys() {
that.$element.options({ self.$list.options({
keys: Ox.unique( keys: Ox.unique(
[self.options.sort[0].key].concat(self.options.keys) [self.options.sort[0].key].concat(self.options.keys)
) )
@ -187,7 +187,7 @@ Ox.InfoList = function(options, self) {
closePreview <f> closePreview closePreview <f> closePreview
@*/ @*/
that.closePreview = function() { that.closePreview = function() {
that.$element.closePreview(); self.$list.closePreview();
return that; return that;
}; };
@ -195,23 +195,23 @@ Ox.InfoList = function(options, self) {
gainFocus <f> gainFocus gainFocus <f> gainFocus
@*/ @*/
that.gainFocus = function() { that.gainFocus = function() {
that.$element.gainFocus(); self.$list.gainFocus();
return that; return that;
}; };
that.getPasteIndex = function() { that.getPasteIndex = function() {
return that.$element.getPasteIndex(); return self.$list.getPasteIndex();
}; };
/*@ /*@
hasFocus <f> hasFocus hasFocus <f> hasFocus
@*/ @*/
that.hasFocus = function() { that.hasFocus = function() {
return that.$element.hasFocus(); return self.$list.hasFocus();
}; };
that.invertSelection = function() { that.invertSelection = function() {
that.$element.invertSelection(); self.$list.invertSelection();
return that; return that;
}; };
@ -219,7 +219,7 @@ Ox.InfoList = function(options, self) {
loseFocus <f> loseFocus loseFocus <f> loseFocus
@*/ @*/
that.loseFocus = function() { that.loseFocus = function() {
that.$element.loseFocus(); self.$list.loseFocus();
return that; return that;
}; };
@ -227,7 +227,7 @@ Ox.InfoList = function(options, self) {
reloadList <f> reloadList reloadList <f> reloadList
@*/ @*/
that.reloadList = function(stayAtPosition) { that.reloadList = function(stayAtPosition) {
that.$element.reloadList(stayAtPosition); self.$list.reloadList(stayAtPosition);
return that; return that;
}; };
@ -235,22 +235,22 @@ Ox.InfoList = function(options, self) {
scrollToSelection <f> scrollToSelection scrollToSelection <f> scrollToSelection
@*/ @*/
that.scrollToSelection = function() { that.scrollToSelection = function() {
that.$element.scrollToSelection(); self.$list.scrollToSelection();
return that; return that;
}; };
that.selectAll = function() { that.selectAll = function() {
that.$element.selectAll(); self.$list.selectAll();
return that; return that;
}; };
that.selectPosition = function(pos) { that.selectPosition = function(pos) {
that.$element.selectPosition(pos); self.$list.selectPosition(pos);
return that; return that;
}; };
that.selectSelected = function(offset) { that.selectSelected = function(offset) {
that.$element.selectSelected(offset); self.$list.selectSelected(offset);
return that; return that;
}; };
@ -258,7 +258,7 @@ Ox.InfoList = function(options, self) {
size <f> size size <f> size
@*/ @*/
that.size = function() { that.size = function() {
that.$element.size(); self.$list.size();
return that; return that;
}; };
@ -272,7 +272,7 @@ Ox.InfoList = function(options, self) {
operator: operator operator: operator
}]; }];
updateKeys(); updateKeys();
that.$element.sortList(key, operator); self.$list.sortList(key, operator);
return that; return that;
}; };
@ -287,12 +287,12 @@ Ox.InfoList = function(options, self) {
var args = Ox.slice(arguments), var args = Ox.slice(arguments),
id = args.shift(); id = args.shift();
if (arguments.length == 1) { if (arguments.length == 1) {
return that.$element.value(id); return self.$list.value(id);
} else if (arguments.length == 2 && Ox.isString(arguments[1])) { } else if (arguments.length == 2 && Ox.isString(arguments[1])) {
return that.$element.value(id, arguments[1]); return self.$list.value(id, arguments[1]);
} else { } else {
Ox.forEach(Ox.makeObject(args), function(value, key) { Ox.forEach(Ox.makeObject(args), function(value, key) {
that.$element.value(id, key, value); self.$list.value(id, key, value);
}); });
return that; return that;
} }