update tab panel and button group so that selected can be set from outside
This commit is contained in:
parent
e7c36dacc8
commit
7e2e0cedb6
2 changed files with 19 additions and 5 deletions
|
@ -75,5 +75,15 @@ Ox.ButtonGroup = function(options, self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return that;
|
that.select = function(id) {
|
||||||
|
// fixme: this doesn't work in cases where
|
||||||
|
// multiple buttons can be selected
|
||||||
|
var position = Ox.getPositionById(self.options.buttons, id);
|
||||||
|
if (position > -1) {
|
||||||
|
self.$buttons[position].trigger('click');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return that;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,12 +20,10 @@ Ox.TabPanel = function(options, self) {
|
||||||
selectable: true,
|
selectable: true,
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
change: function(event) {
|
change: function(data) {
|
||||||
self.selected = event.selected[0];
|
self.selected = data.selected[0];
|
||||||
that.$element.replaceElement(1, self.options.content(self.selected));
|
that.$element.replaceElement(1, self.options.content(self.selected));
|
||||||
that.triggerEvent('change', {
|
that.triggerEvent('change', {selected: self.selected});
|
||||||
selected: self.selected
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.appendTo(self.$bar);
|
.appendTo(self.$bar);
|
||||||
|
@ -50,6 +48,12 @@ Ox.TabPanel = function(options, self) {
|
||||||
})[0].id;
|
})[0].id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
that.select = function(id) {
|
||||||
|
if (Ox.getPositionById(self.options.tabs, id) > -1) {
|
||||||
|
self.$tabs.select(id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
that.selected = function() {
|
that.selected = function() {
|
||||||
return self.selected;
|
return self.selected;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue