List: use on, not scroll; cosmetic changes

This commit is contained in:
rlx 2014-09-22 16:24:11 +02:00
parent 5314f6c73a
commit ac3b736e72

View file

@ -116,7 +116,9 @@ Ox.List = function(options, self) {
sort: updateSort, sort: updateSort,
sortable: updateSortable sortable: updateSortable
}) })
.scroll(scroll); .on({
scroll: scroll
});
self.options.sort = self.options.sort.map(function(sort) { self.options.sort = self.options.sort.map(function(sort) {
return Ox.isString(sort) ? { return Ox.isString(sort) ? {
@ -530,7 +532,11 @@ Ox.List = function(options, self) {
function findCell(e) { function findCell(e) {
var $element = $(e.target); var $element = $(e.target);
while (!$element.is('.OxCell') && !$element.is('.OxPage') && !$element.is('body')) { while (
!$element.is('.OxCell')
&& !$element.is('.OxPage')
&& !$element.is('body')
) {
$element = $element.parent(); $element = $element.parent();
} }
return $element.is('.OxCell') ? $element : null; return $element.is('.OxCell') ? $element : null;
@ -849,12 +855,12 @@ Ox.List = function(options, self) {
result.data.items.forEach(function(v, i) { result.data.items.forEach(function(v, i) {
var pos = offset + i; var pos = offset + i;
self.$items[pos] = Ox.ListItem({ self.$items[pos] = Ox.ListItem({
construct: self.options.construct, construct: self.options.construct,
data: v, data: v,
//format: self.options.format, //format: self.options.format,
position: pos, position: pos,
unique: self.options.unique unique: self.options.unique
}); });
isSelected(pos) && self.$items[pos].addClass('OxSelected'); isSelected(pos) && self.$items[pos].addClass('OxSelected');
self.$items[pos].appendTo(self.$pages[page]); self.$items[pos].appendTo(self.$pages[page]);
}); });