List: Add selectbefore and selectafter events (fixes #353)

This commit is contained in:
rlx 2012-02-15 11:30:01 +00:00
parent 08423110e9
commit 2be6052276

View file

@ -535,9 +535,9 @@ Ox.List = function(options, self) {
function getNext() { function getNext() {
var pos = -1; var pos = -1;
if (self.selected.length) { if (self.selected.length) {
pos = (self.options.orientation == 'both' ? pos = (self.options.orientation == 'both'
self.selected[self.selected.length - 1] : ? self.selected[self.selected.length - 1]
Ox.max(self.selected)) + 1; : Ox.max(self.selected)) + 1;
if (pos == self.$items.length) { if (pos == self.$items.length) {
pos = -1; pos = -1;
} }
@ -1202,6 +1202,8 @@ Ox.List = function(options, self) {
if (pos > -1) { if (pos > -1) {
select(pos); select(pos);
scrollToPosition(pos); scrollToPosition(pos);
} else if (self.selected.length) {
that.triggerEvent('selectafter');
} }
} }
@ -1214,6 +1216,8 @@ Ox.List = function(options, self) {
if (pos > -1) { if (pos > -1) {
select(pos); select(pos);
scrollToPosition(pos); scrollToPosition(pos);
} else if (self.selected.length) {
that.triggerEvent('selectbefore');
} }
} }