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

View file

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