some quick and ugly fixes to make TreeList work again
This commit is contained in:
parent
fb8dd98b8a
commit
1f8f9ffa7d
3 changed files with 8 additions and 7 deletions
|
@ -7,7 +7,7 @@
|
||||||
/*
|
/*
|
||||||
Since we will be doing some mapping, we have to load the Geo module.
|
Since we will be doing some mapping, we have to load the Geo module.
|
||||||
*/
|
*/
|
||||||
Ox.load({UI: {}, Geo: {}}, function() {
|
Ox.load({UI: {showScreen: true}, Geo: {}}, function() {
|
||||||
|
|
||||||
Ox.getJSON('json/cities.json', function(cities) {
|
Ox.getJSON('json/cities.json', function(cities) {
|
||||||
|
|
||||||
|
|
|
@ -1463,9 +1463,9 @@ Ox.List = function(options, self) {
|
||||||
$item.insertAfter($items[i - 1]);
|
$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.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items));
|
||||||
self.listLength = self.options.items.length;
|
///////self.listLength = self.options.items.length;
|
||||||
//loadItems();
|
//loadItems();
|
||||||
updatePositions();
|
updatePositions();
|
||||||
}
|
}
|
||||||
|
@ -1569,14 +1569,14 @@ Ox.List = function(options, self) {
|
||||||
self.selected.indexOf(i) > -1 && deselect(i);
|
self.selected.indexOf(i) > -1 && deselect(i);
|
||||||
self.$items[i].remove();
|
self.$items[i].remove();
|
||||||
});
|
});
|
||||||
self.options.items.splice(pos, length);
|
///////self.options.items.splice(pos, length);
|
||||||
self.$items.splice(pos, length);
|
self.$items.splice(pos, length);
|
||||||
self.selected.forEach(function(v, i) {
|
self.selected.forEach(function(v, i) {
|
||||||
if (v >= pos + length) {
|
if (v >= pos + length) {
|
||||||
self.selected[i] -= length;
|
self.selected[i] -= length;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.listLength = self.options.items.length;
|
///////self.listLength = self.options.items.length;
|
||||||
updatePositions();
|
updatePositions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ Ox.TreeList = function(options, self) {
|
||||||
itemHeight: 16,
|
itemHeight: 16,
|
||||||
items: parseItems(),
|
items: parseItems(),
|
||||||
itemWidth: self.options.width,
|
itemWidth: self.options.width,
|
||||||
|
keys: ['expanded', 'id', 'items', 'level', 'title'],
|
||||||
max: self.options.max,
|
max: self.options.max,
|
||||||
min: self.options.min,
|
min: self.options.min,
|
||||||
unique: 'id'
|
unique: 'id'
|
||||||
|
@ -73,7 +74,7 @@ Ox.TreeList = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function constructItem(data) {
|
function constructItem(data) {
|
||||||
var $item = $('<div>'), //.css({width: self.options.width + 'px'}),
|
var $item = $('<div>').css({width: self.options.width + 'px'}),
|
||||||
padding = (data.level + !data.items) * 16 - 8;
|
padding = (data.level + !data.items) * 16 - 8;
|
||||||
if (data.level || !data.items) {
|
if (data.level || !data.items) {
|
||||||
$('<div>')
|
$('<div>')
|
||||||
|
@ -111,7 +112,7 @@ Ox.TreeList = function(options, self) {
|
||||||
.css({
|
.css({
|
||||||
width: (self.options.width - padding - 32 + !data.items * 16) + 'px'
|
width: (self.options.width - padding - 32 + !data.items * 16) + 'px'
|
||||||
})
|
})
|
||||||
.html(data.title)
|
.html(data.title || '')
|
||||||
.appendTo($item);
|
.appendTo($item);
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue