summaryrefslogtreecommitdiff
path: root/program/js/treelist.js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/treelist.js')
-rw-r--r--program/js/treelist.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/program/js/treelist.js b/program/js/treelist.js
index 4beaadab9..d6d50e4f7 100644
--- a/program/js/treelist.js
+++ b/program/js/treelist.js
@@ -263,7 +263,7 @@ function rcube_treelist_widget(node, p)
if (sibling) {
li.insertAfter(sibling);
}
- else {
+ else if (first.id != myid) {
li.insertBefore(first);
}
@@ -380,18 +380,20 @@ function rcube_treelist_widget(node, p)
{
var result = [];
ul.children('li').each(function(i,e){
- var li = $(e);
+ var li = $(e), sublist = li.children('ul');
var node = {
id: dom2id(li),
classes: li.attr('class').split(' '),
virtual: li.hasClass('virtual'),
html: li.children().first().get(0).outerHTML,
- children: walk_list(li.children('ul'))
+ children: walk_list(sublist)
}
+ if (sublist.length) {
+ node.childlistclass = sublist.attr('class');
+ }
if (node.children.length) {
- node.childlistclass = li.children('ul').attr('class');
- node.collapsed = li.children('ul').css('display') == 'none';
+ node.collapsed = sublist.css('display') == 'none';
}
if (li.hasClass('selected')) {
selection = node.id;