-
-
- Change The Tree Definition
-
+
+ Change The Tree Definition
Load Tree Data Asynchronously
- Test the Tree Control API:
-
- First Branch
-
+ Test the Tree Control API:
+ First Branch
Next Sibling
- Prev Sibling
-
+ Prev Sibling
Next Branch
- Prev Branch
-
+ Prev Branch
Parent
Expand
@@ -77,9 +62,8 @@ Test the Tree Control API:
Add Branch
-
diff --git a/test/bs2_ng120_test_page.html b/test/bs2_ng120_test_page.html
index 37ae711..80668b7 100644
--- a/test/bs2_ng120_test_page.html
+++ b/test/bs2_ng120_test_page.html
@@ -25,24 +25,15 @@ angular-bootstrap-nav-tree
- by Nick Perkins
- The code is on Github
+ by Nick Perkins The code is on Github
@@ -52,22 +43,16 @@ Angular 1.2.12
-
-
- Change The Tree Definition
-
+
+ Change The Tree Definition
Load Tree Data Asynchronously
- Test the Tree Control API:
-
- First Branch
-
+ Test the Tree Control API:
+ First Branch
Next Sibling
- Prev Sibling
-
+ Prev Sibling
Next Branch
- Prev Branch
-
+ Prev Branch
Parent
Expand
@@ -78,9 +63,8 @@ Test the Tree Control API:
Add Branch
-
diff --git a/test/bs3_ng115_test_page.html b/test/bs3_ng115_test_page.html
index 6cea588..8206d59 100644
--- a/test/bs3_ng115_test_page.html
+++ b/test/bs3_ng115_test_page.html
@@ -24,24 +24,15 @@ angular-bootstrap-nav-tree
- by Nick Perkins
- The code is on Github
+ by Nick Perkins The code is on Github
@@ -51,22 +42,16 @@ Angular 1.1.5
-
-
- Change The Tree Definition
-
+
+ Change The Tree Definition
Load Tree Data Asynchronously
- Test the Tree Control API:
-
- First Branch
-
+ Test the Tree Control API:
+ First Branch
Next Sibling
- Prev Sibling
-
+ Prev Sibling
Next Branch
- Prev Branch
-
+ Prev Branch
Parent
Expand
@@ -77,9 +62,8 @@ Test the Tree Control API:
Add Branch
-
diff --git a/test/bs3_ng120_test_page.html b/test/bs3_ng120_test_page.html
index 919ee8e..68ece5f 100644
--- a/test/bs3_ng120_test_page.html
+++ b/test/bs3_ng120_test_page.html
@@ -25,24 +25,15 @@ angular-bootstrap-nav-tree
- by Nick Perkins
- The code is on Github
+ by Nick Perkins The code is on Github
@@ -52,22 +43,16 @@ Angular 1.2.12
-
-
- Change The Tree Definition
-
+
+ Change The Tree Definition
Load Tree Data Asynchronously
- Test the Tree Control API:
-
- First Branch
-
+ Test the Tree Control API:
+ First Branch
Next Sibling
- Prev Sibling
-
+ Prev Sibling
Next Branch
- Prev Branch
-
+ Prev Branch
Parent
Expand
@@ -78,9 +63,8 @@ Test the Tree Control API:
Add Branch
-
diff --git a/test/test_page.coffee b/test/test_page.coffee
index c857473..997ae2b 100644
--- a/test/test_page.coffee
+++ b/test/test_page.coffee
@@ -21,6 +21,22 @@ app.controller 'AbnTestController',($scope,$timeout)->
# ...but your handler could do anything here...
#
+ #
+ # a default "on-check" handler can be specified
+ # for the tree ( as attribute "on-check" )
+ #
+ $scope.my_tree_check = (checkedes)->
+ $scope.output = "You checked: "
+ if !!checkedes && checkedes.length > 0
+ for branch in checkedes
+ $scope.output += branch.label
+ if branch.data?.description
+ $scope.output += '('+branch.data.description+')'
+ #
+ # This example handler just sets "output",
+ # ...but your handler could do anything here...
+ #
+
#
# Each branch can define an "on-select" handler,
@@ -61,10 +77,12 @@ app.controller 'AbnTestController',($scope,$timeout)->
description:"man's best friend"
,
label:'Cat'
+ uid:'02'
data:
description:"Felis catus"
,
label:'Hippopotamus'
+ uid:'03'
data:
description:"hungry, hungry"
,
@@ -74,6 +92,7 @@ app.controller 'AbnTestController',($scope,$timeout)->
,
label:'Vegetable'
+ uid:"2"
data:
definition:"A plant or part of a plant used as food, typically as accompaniment to meat or fish, such as a cabbage, potato, carrot, or bean."
data_can_contain_anything:true
@@ -81,6 +100,12 @@ app.controller 'AbnTestController',($scope,$timeout)->
onSelect:(branch)->
# special "on-select" function for this branch
$scope.output = "Vegetable: "+branch.data.definition
+ onCheck:(branch)->
+ # special "on-check" function for this branch
+ if branch.checked == 2
+ $scope.output = "Check Vegetable: "+branch.data.definition
+ else
+ $scope.output = "UnCheck Vegetable: "+branch.data.definition
children:[
@@ -147,7 +172,6 @@ app.controller 'AbnTestController',($scope,$timeout)->
]
]
-
$scope.my_data = treedata_avm
$scope.try_changing_the_tree_data = ()->
#
diff --git a/test/test_page.jade b/test/test_page.jade
index cb93404..e578bcc 100644
--- a/test/test_page.jade
+++ b/test/test_page.jade
@@ -162,8 +162,10 @@ html(ng-app='AbnTest')
tree-data = "my_data"
tree-control = "my_tree"
on-select = "my_tree_handler(branch)"
+ on-check = "my_tree_check(checkedes)"
expand-level = "2"
initial-selection = "Granny Smith"
+ initial-checked = "['02','03','2']"
)
td(style="padding:20px;vertical-align:top;")
diff --git a/test/test_page.js b/test/test_page.js
index 17a4519..4fbb8ff 100644
--- a/test/test_page.js
+++ b/test/test_page.js
@@ -18,6 +18,23 @@
return $scope.output += '(' + branch.data.description + ')';
}
};
+ $scope.my_tree_check = function(checkedes) {
+ var branch, _i, _len, _ref, _results;
+ $scope.output = "You checked: ";
+ if (!!checkedes && checkedes.length > 0) {
+ _results = [];
+ for (_i = 0, _len = checkedes.length; _i < _len; _i++) {
+ branch = checkedes[_i];
+ $scope.output += branch.label;
+ if ((_ref = branch.data) != null ? _ref.description : void 0) {
+ _results.push($scope.output += '(' + branch.data.description + ')');
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ }
+ };
apple_selected = function(branch) {
return $scope.output = "APPLE! : " + branch.label;
};
@@ -32,11 +49,13 @@
}
}, {
label: 'Cat',
+ uid: '02',
data: {
description: "Felis catus"
}
}, {
label: 'Hippopotamus',
+ uid: '03',
data: {
description: "hungry, hungry"
}
@@ -47,6 +66,7 @@
]
}, {
label: 'Vegetable',
+ uid: "2",
data: {
definition: "A plant or part of a plant used as food, typically as accompaniment to meat or fish, such as a cabbage, potato, carrot, or bean.",
data_can_contain_anything: true
@@ -54,6 +74,13 @@
onSelect: function(branch) {
return $scope.output = "Vegetable: " + branch.data.definition;
},
+ onCheck: function(branch) {
+ if (branch.checked === 2) {
+ return $scope.output = "Check Vegetable: " + branch.data.definition;
+ } else {
+ return $scope.output = "UnCheck Vegetable: " + branch.data.definition;
+ }
+ },
children: [
{
label: 'Oranges'
diff --git a/test/tests_page.html b/test/tests_page.html
index e2e4283..e9d5ee3 100644
--- a/test/tests_page.html
+++ b/test/tests_page.html
@@ -5,15 +5,6 @@
angular-bootstrap-nav-tree
- test pages:
-
-
- Bootstrap 2 / Angular 1.1.5
-
- Bootstrap 3 / Angular 1.1.5
-
- Bootstrap 2 / Angular 1.2.0
-
- Bootstrap 3 / Angular 1.2.0
+ test pages: Bootstrap 2 / Angular 1.1.5 Bootstrap 3 / Angular 1.1.5 Bootstrap 2 / Angular 1.2.0 Bootstrap 3 / Angular 1.2.0