Hello All,
I created a directive in my angularjs application and used kendoui tree in this directive. I want to bind selected nodes (checkbox checked) of this tree to outer scope. My directive looks like this;
<yte-tree-view id="yteKendoUrunTree" data="yteTreeData" text-field="categoryName" selectable="true" ng-model="selectedTreeItems">
<yte-tree-branch property="urunListesi" text-field="productName">
<yte-tree-branch property="altUrunListesi" text-field="subProductName"/>
</yte-tree-branch>
</yte-tree-view>
data attribute here is a hierarchical data and in my directive.js file i define tree options like that;
var defaultOptions = {};
defaultOptions.checkboxes = angular.isUndefined(scope.selectable) ? false : {
checkChildren: true,
template: "# if(!item.hasChildren){ # <input type='checkbox' id='c_#= item.id #' class='yteTreeLeafCheckbox' /># } " +
"else { # <input type='checkbox' id='c_#= item.id #' class='yteTreeBranchCheckbox' /> #}#"
};
defaultOptions.textFieldList = [scope.textField].concat(scope.branch.textFieldList);
and after that i initialize the kendoui treeview with this settings;
var yteKendoTree = $('#' + scope.id).kendoTreeView({
dataTextField: defaultOptions.textFieldList,
checkboxes: defaultOptions.checkboxes,
loadOnDemand: false,
dataSource: {
data: scope.data
}
}).data("kendoTreeView");
after all of these codes i need to register an event that fired when any of the leaf checkboxes changed (checked or unchecked). I tried all possible events on all possible elements but it did not worked at all. for example;
yteKendoTree.bind("change", function (e) {
alert("Tree Change Event: checkbox checked!");
// set viewValue of ng-model to selectedItems of the kendoui tree
});
or
yteKendoTree.dataSource.bind("change", function() {
alert("Datasource Change Event: checkbox checked!");
// set viewValue of ng-model to selectedItems of the kendoui tree
});
or
$(".yteTreeLeafCheckbox").bind("change", function () {
alert("Checkbox Change Event: checkbox checked!");
// set viewValue of ng-model to selectedItems of the kendoui tree
});
and tried a few versions of these events too. But none of them are triggered when any of the checkboxes checked on the tree. Only first one triggering when i clicked a label on the tree but not on checkbox check time.
Thanks.
Ibrahim.
I created a directive in my angularjs application and used kendoui tree in this directive. I want to bind selected nodes (checkbox checked) of this tree to outer scope. My directive looks like this;
<yte-tree-view id="yteKendoUrunTree" data="yteTreeData" text-field="categoryName" selectable="true" ng-model="selectedTreeItems">
<yte-tree-branch property="urunListesi" text-field="productName">
<yte-tree-branch property="altUrunListesi" text-field="subProductName"/>
</yte-tree-branch>
</yte-tree-view>
data attribute here is a hierarchical data and in my directive.js file i define tree options like that;
var defaultOptions = {};
defaultOptions.checkboxes = angular.isUndefined(scope.selectable) ? false : {
checkChildren: true,
template: "# if(!item.hasChildren){ # <input type='checkbox' id='c_#= item.id #' class='yteTreeLeafCheckbox' /># } " +
"else { # <input type='checkbox' id='c_#= item.id #' class='yteTreeBranchCheckbox' /> #}#"
};
defaultOptions.textFieldList = [scope.textField].concat(scope.branch.textFieldList);
and after that i initialize the kendoui treeview with this settings;
var yteKendoTree = $('#' + scope.id).kendoTreeView({
dataTextField: defaultOptions.textFieldList,
checkboxes: defaultOptions.checkboxes,
loadOnDemand: false,
dataSource: {
data: scope.data
}
}).data("kendoTreeView");
after all of these codes i need to register an event that fired when any of the leaf checkboxes changed (checked or unchecked). I tried all possible events on all possible elements but it did not worked at all. for example;
yteKendoTree.bind("change", function (e) {
alert("Tree Change Event: checkbox checked!");
// set viewValue of ng-model to selectedItems of the kendoui tree
});
or
yteKendoTree.dataSource.bind("change", function() {
alert("Datasource Change Event: checkbox checked!");
// set viewValue of ng-model to selectedItems of the kendoui tree
});
or
$(".yteTreeLeafCheckbox").bind("change", function () {
alert("Checkbox Change Event: checkbox checked!");
// set viewValue of ng-model to selectedItems of the kendoui tree
});
and tried a few versions of these events too. But none of them are triggered when any of the checkboxes checked on the tree. Only first one triggering when i clicked a label on the tree but not on checkbox check time.
Thanks.
Ibrahim.