forked from 0x2620/oxjs
fix the tree list disclosure triangle bug
This commit is contained in:
parent
60165632c5
commit
c589594e8e
2 changed files with 8 additions and 13 deletions
|
|
@ -45,11 +45,11 @@ Ox.TreeList = function(options, self) {
|
|||
function clickItem(e) {
|
||||
var $target = $(e.target),
|
||||
$item, id, item;
|
||||
if ($target.hasClass('OxToggle')) {
|
||||
if ($target.is('.OxToggle')) {
|
||||
$item = $target.parent().parent();
|
||||
id = $item.data('id');
|
||||
item = getItemById(id);
|
||||
toggleItem(item, !item.expanded)
|
||||
toggleItem(item, !item.expanded);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,16 +160,16 @@ Ox.TreeList = function(options, self) {
|
|||
function toggleItem(item, expanded) {
|
||||
var $img, pos;
|
||||
item.expanded = expanded;
|
||||
getItemById(item.id).expanded = expanded;
|
||||
Ox.print('>>>>', getItemById(item.id))
|
||||
$.each(that.$element.find('.OxItem'), function(i, v) {
|
||||
var $item = $(v);
|
||||
if ($item.data('id') == item.id) {
|
||||
$img = $item.find('img');
|
||||
$img = $item.find('.OxToggle');
|
||||
pos = $item.data('position');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
Ox.print('i.e', item.expanded, $img, $img.attr('src'));
|
||||
// FIXME: why does this not work??
|
||||
///*
|
||||
$img.attr({
|
||||
src: Ox.UI.getImagePath(
|
||||
|
|
@ -177,14 +177,7 @@ Ox.TreeList = function(options, self) {
|
|||
)
|
||||
});
|
||||
//*/
|
||||
/*
|
||||
Ox.print($img.attr('src'))
|
||||
$img.attr({
|
||||
src: $img.attr('src') == Ox.UI.getImagePath('symbolDown.svg') ?
|
||||
Ox.UI.getImagePath('symbolRight.svg') :
|
||||
Ox.UI.getImagePath('symbolDown.svg')
|
||||
});
|
||||
*/
|
||||
that.$element.value(item.id, 'expanded', expanded);
|
||||
item.expanded ?
|
||||
that.$element.addItems(pos + 1, parseItems(item.items, item.level + 1)) :
|
||||
that.$element.removeItems(pos + 1, parseItems(item.items, item.level + 1).length);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue