Skip to content

Commit 2eb9dfc

Browse files
committed
Children lazy empty nodes remain checked when parent is unchecked with hierarchical multi-selection
Close mar10#250
1 parent 3b595b3 commit 2eb9dfc

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 2.2.0 / Unreleased
22
* [Improved] #245 tree.generateInput() now returns data using PHPs array
3-
convention, i.e. by appending '[]' to the name.
3+
convention, i.e. by appending brackets to the name: 'ft_1[]'.
4+
* [Fixed] #250: Children lazy empty nodes remain checked when parent is unchecked with hierarchical multi-selection
45

56

67
# 2.1.0 / 2014-05-29

demo/sample-select.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
}
4141
]
4242
},
43-
{title: "Document with some children (expanded on init)", key: "id4", expand: true,
43+
{title: "Document with some children (expanded on init)", key: "id4", expanded: true,
4444
children: [
45-
{title: "Sub-item 4.1 (active on init)", activate: true,
45+
{title: "Sub-item 4.1 (active on init)", active: true,
4646
children: [
4747
{title: "Sub-item 4.1.1", key: "id4.1.1" },
4848
{title: "Sub-item 4.1.2", key: "id4.1.2" }
@@ -57,7 +57,8 @@
5757
{title: "Sub-item 4.3 (hideCheckbox)", hideCheckbox: true },
5858
{title: "Sub-item 4.4 (unselectable)", unselectable: true }
5959
]
60-
}
60+
},
61+
{title: "Lazy folder", folder: true, lazy: true }
6162
];
6263
$(function(){
6364

@@ -123,6 +124,12 @@
123124
checkbox: true,
124125
selectMode: 3,
125126
source: treeData,
127+
lazyLoad: function(event, ctx) {
128+
ctx.result = {url: "ajax-sub2.json", debugDelay: 1000};
129+
},
130+
loadChildren: function(event, ctx) {
131+
ctx.node.fixSelection3AfterClick();
132+
},
126133
select: function(event, data) {
127134
// Get a list of all selected nodes, and convert to a key array:
128135
var selKeys = $.map(data.tree.getSelectedNodes(), function(node){

src/jquery.fancytree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ FancytreeNode.prototype = /** @lends FancytreeNode# */{
614614
var i, l, child, s, state, allSelected,someSelected,
615615
children = node.children;
616616

617-
if( children ){
617+
if( children && children.length ){
618618
// check all children recursively
619619
allSelected = true;
620620
someSelected = false;

0 commit comments

Comments
 (0)