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