From 2be60522768f39d8e8f96c90fc172b47fb6d5f5a Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Wed, 15 Feb 2012 11:30:01 +0000 Subject: [PATCH] List: Add selectbefore and selectafter events (fixes #353) --- source/Ox.UI/js/List/Ox.List.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index a93cb97a..a932f1cc 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -535,9 +535,9 @@ Ox.List = function(options, self) { function getNext() { var pos = -1; if (self.selected.length) { - pos = (self.options.orientation == 'both' ? - self.selected[self.selected.length - 1] : - Ox.max(self.selected)) + 1; + pos = (self.options.orientation == 'both' + ? self.selected[self.selected.length - 1] + : Ox.max(self.selected)) + 1; if (pos == self.$items.length) { pos = -1; } @@ -1202,6 +1202,8 @@ Ox.List = function(options, self) { if (pos > -1) { select(pos); scrollToPosition(pos); + } else if (self.selected.length) { + that.triggerEvent('selectafter'); } } @@ -1214,6 +1216,8 @@ Ox.List = function(options, self) { if (pos > -1) { select(pos); scrollToPosition(pos); + } else if (self.selected.length) { + that.triggerEvent('selectbefore'); } }