EExamplePanel: make sure items are sorted alphabetically
This commit is contained in:
parent
422258448e
commit
e8f3caff8e
1 changed files with 7 additions and 1 deletions
|
@ -118,7 +118,9 @@ Ox.ExamplePanel = function(options, self) {
|
|||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}) : [];
|
||||
items.push(item);
|
||||
items.length == self.options.examples.length && callback(items);
|
||||
if (items.length == self.options.examples.length) {
|
||||
callback(items.sort(sortById));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -154,6 +156,10 @@ Ox.ExamplePanel = function(options, self) {
|
|||
that.triggerEvent('select', {id: self.options.selected});
|
||||
}
|
||||
|
||||
function sortById(a, b) {
|
||||
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
||||
}
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue