fix for cases where passing an array of tooltips as an option to Ox.Button would cause Ox.Element to actually set the tooltip to that array

This commit is contained in:
rlx 2011-11-05 14:29:31 +00:00
parent 2df5d05980
commit 5a23d8936b
4 changed files with 18 additions and 9 deletions

View file

@ -251,6 +251,8 @@ Ox.Element = function(options, self) {
}); });
that.bind({ that.bind({
mouseenter: mouseenter mouseenter: mouseenter
}).unbind({
mousemove: mousemove
}); });
} else { } else {
that.$tooltip = Ox.Tooltip({ that.$tooltip = Ox.Tooltip({
@ -258,13 +260,22 @@ Ox.Element = function(options, self) {
}); });
that.bind({ that.bind({
mousemove: mousemove mousemove: mousemove
}).unbind({
mouseenter: mouseenter
}); });
} }
that.bind({ that.bind({
mouseleave: mouseleave mouseleave: mouseleave
}); });
} else { } else {
that.$tooltip && that.$tooltip.remove(); if (that.$tooltip) {
that.$tooltip.remove();
that.unbind({
mouseenter: mouseenter,
mousemove: mousemove,
mouseleave: mouseleave
});
}
} }
} }
@ -277,8 +288,6 @@ Ox.Element = function(options, self) {
} }
}; };
that._self = self; // fixme: remove
/*@ /*@
bindEvent <function> Binds a function to an event bindEvent <function> Binds a function to an event
(event, callback) -> <o> This element (event, callback) -> <o> This element

View file

@ -42,7 +42,10 @@ Ox.Button = function(options, self) {
type: 'text', type: 'text',
width: 'auto' width: 'auto'
}) })
.options(options || {}) .options(options ? Ox.extend(Ox.clone(options), {
// tooltip may be an array, so we can't pass it yet
tooltip: ''
}) : {})
.attr({ .attr({
disabled: self.options.disabled, disabled: self.options.disabled,
type: self.options.type == 'text' ? 'button' : 'image' type: self.options.type == 'text' ? 'button' : 'image'
@ -71,9 +74,8 @@ Ox.Button = function(options, self) {
setTitle(self.titles[self.selectedTitle].title); setTitle(self.titles[self.selectedTitle].title);
if (self.options.tooltip) { if (options.tooltip) {
self.tooltips = Ox.isArray(self.options.tooltip) self.tooltips = Ox.toArray(options.tooltip);
? self.options.tooltip : [self.options.tooltip];
that.options({tooltip: self.tooltips[self.selectedTitle]}); that.options({tooltip: self.tooltips[self.selectedTitle]});
} }

View file

@ -44,7 +44,6 @@ Ox.ListItem = function(options, self) {
} }
// that.$element = $element; // that.$element = $element;
that.setElement($element); that.setElement($element);
Ox.print('LISTITEM', that.$element.data('id'))
} }
self.setOption = function(key, value) { self.setOption = function(key, value) {

View file

@ -737,7 +737,6 @@ Ox.TextList = function(options, self) {
that.$element.find('.OxCell.OxColumn' + Ox.toTitleCase(self.options.columns[i].id)).css({ that.$element.find('.OxCell.OxColumn' + Ox.toTitleCase(self.options.columns[i].id)).css({
width: width - (self.options.columnsVisible ? 9 : 8) + 'px' width: width - (self.options.columnsVisible ? 9 : 8) + 'px'
}); });
Ox.Log('??? resize column')
setWidth(); setWidth();
} }