1
0
Fork 0
forked from 0x2620/oxjs

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
commit 5a23d8936b
4 changed files with 18 additions and 9 deletions

View file

@ -251,6 +251,8 @@ Ox.Element = function(options, self) {
});
that.bind({
mouseenter: mouseenter
}).unbind({
mousemove: mousemove
});
} else {
that.$tooltip = Ox.Tooltip({
@ -258,13 +260,22 @@ Ox.Element = function(options, self) {
});
that.bind({
mousemove: mousemove
}).unbind({
mouseenter: mouseenter
});
}
that.bind({
mouseleave: mouseleave
});
} 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
(event, callback) -> <o> This element

View file

@ -42,7 +42,10 @@ Ox.Button = function(options, self) {
type: 'text',
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({
disabled: self.options.disabled,
type: self.options.type == 'text' ? 'button' : 'image'
@ -71,9 +74,8 @@ Ox.Button = function(options, self) {
setTitle(self.titles[self.selectedTitle].title);
if (self.options.tooltip) {
self.tooltips = Ox.isArray(self.options.tooltip)
? self.options.tooltip : [self.options.tooltip];
if (options.tooltip) {
self.tooltips = Ox.toArray(options.tooltip);
that.options({tooltip: self.tooltips[self.selectedTitle]});
}

View file

@ -44,7 +44,6 @@ Ox.ListItem = function(options, self) {
}
// that.$element = $element;
that.setElement($element);
Ox.print('LISTITEM', that.$element.data('id'))
}
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({
width: width - (self.options.columnsVisible ? 9 : 8) + 'px'
});
Ox.Log('??? resize column')
setWidth();
}