fix a bug in Ox.List where a select event would trigger even though the selection had not changed

This commit is contained in:
rlx 2012-02-15 20:21:17 +00:00
parent 95da27d0db
commit 8b9c5a485b
2 changed files with 11 additions and 6 deletions

View file

@ -1248,7 +1248,7 @@ Ox.List = function(options, self) {
var pos = getPositionById(id);
if (pos > -1) {
select(pos, i);
} else {
} else if (self.isAsync) {
// async and id not in current view
self.options.items({
positions: [id],
@ -1465,7 +1465,7 @@ Ox.List = function(options, self) {
self.setOption = function(key, value) {
//Ox.Log('List', 'list setOption', key, value);
var selectedIds;
var previousSelected;
if (key == 'items') {
// fixme: this could be used to change the list
// from sync to async or vice versa, which wouldn't work
@ -1478,10 +1478,14 @@ Ox.List = function(options, self) {
}
} else if (key == 'selected') {
//Ox.Log('List', 'setOption selected', value)
previousSelected = self.selected;
setSelected(value);
// fixme: next line added to make text list find-as-you-type work,
// may break other things
!self.isAsync && triggerSelectEvent(value);
// fixme: the following was added in order
// to make text list find-as-you-type work,
// this may break other things
if (!self.isAsync && !Ox.isEqual(self.selected, previousSelected)) {
triggerSelectEvent(value);
}
} else if (key == 'sort') {
//Ox.Log('List', '---sort---')
updateSort();

View file

@ -1208,7 +1208,8 @@ Ox.VideoEditor = function(options, self) {
}
function toggleSize() {
self.options.videoSize = self.options.videoSize == 'small' ? 'large' : 'small';
self.options.videoSize = self.options.videoSize == 'small'
? 'large' : 'small';
setSizes();
self.$videoMenuButton.checkItem(self.options.videoSize);
self.$player[0].options({