re-enable synchronous path in Ox.List for Ox.TreeList

This commit is contained in:
rolux 2012-04-08 14:17:58 +02:00
parent c3bbf600c9
commit a69970adb6
3 changed files with 9 additions and 8 deletions

View file

@ -54,6 +54,7 @@ Ox.List = function(options, self) {
self = self || {};
var that = Ox.Container({}, self)
.defaults({
_tree: false,
centered: false,
construct: null,
draggable: false,
@ -83,7 +84,7 @@ Ox.List = function(options, self) {
} : sort;
});
if (Ox.isArray(self.options.items)) {
if (Ox.isArray(self.options.items) && !self.options._tree) {
self.options.items = Ox.api(self.options.items, {
cache: true,
sort: self.options.sort,
@ -121,7 +122,8 @@ Ox.List = function(options, self) {
$items: [],
$pages: [],
format: {},
isAsync: true,
//isAsync: true,
isAsync: !self.options._tree,
itemMargin: self.options.type == 'text' ? 0 : 8, // 2 x 4 px margin ... fixme: the 2x should be computed later
keyboardEvents: {
key_control_c: copyItems,
@ -457,7 +459,6 @@ Ox.List = function(options, self) {
var height = getHeight(),
lastItemHeight = height % self.options.itemHeight || self.options.itemHeight,
visibleItems = Math.ceil(height / self.options.itemHeight);
//Ox.print('FFP!!!', height)
if (self.listLength < visibleItems) {
Ox.range(self.listLength, visibleItems).forEach(function(i) {
var $item = Ox.ListItem({
@ -1463,9 +1464,9 @@ Ox.List = function(options, self) {
$item.insertAfter($items[i - 1]);
}
});
///////self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items));
self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items));
self.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items));
///////self.listLength = self.options.items.length;
self.listLength = self.options.items.length;
//loadItems();
updatePositions();
}
@ -1569,14 +1570,14 @@ Ox.List = function(options, self) {
self.selected.indexOf(i) > -1 && deselect(i);
self.$items[i].remove();
});
///////self.options.items.splice(pos, length);
self.options.items.splice(pos, length);
self.$items.splice(pos, length);
self.selected.forEach(function(v, i) {
if (v >= pos + length) {
self.selected[i] -= length;
}
});
///////self.listLength = self.options.items.length;
self.listLength = self.options.items.length;
updatePositions();
}
}

View file

@ -604,7 +604,6 @@ Ox.TextList = function(options, self) {
}
function getCell(id, key) {
Ox.print('List', 'getCell', id, key)
var $item = getItem(id);
key = key || ''; // fixme: what is this?
return $($item.find('.OxCell.OxColumn' + Ox.toTitleCase(key))[0]);

View file

@ -44,6 +44,7 @@ Ox.TreeList = function(options, self) {
}
that.$element = Ox.List({
_tree: true,
construct: constructItem,
itemHeight: 16,
items: parseItems(),