Hi folks, first time post, had to happen eventually...
I'm using to TreeView to represent a hierarchy of user levels, and have enabled checkboxes and drag&drop. I also have two buttons, Add User and Modify User. If no user is selected, Add User button is enabled and Modify User button is disabled. Inversely, if a user is selected, Modify User is enabled and Add User is disabled.
In the code I have a little jQuery:
Two things, and I realize this may not be the way to approach, since, after all, it IS failing miserably, despite it being a Friday...
1) For the first item in the treeview, after the first two clicks (check box, uncheck box) it then begins to toggle the buttons appropriately. However, it logs the change to the console consistently, every time.
2) The toggle only works for the first checkbox, and no others;
Clearly, this is the wrong way to approach this, so, in summation, how do I implement this functionality correctly with the treeview?
I'm using to TreeView to represent a hierarchy of user levels, and have enabled checkboxes and drag&drop. I also have two buttons, Add User and Modify User. If no user is selected, Add User button is enabled and Modify User button is disabled. Inversely, if a user is selected, Modify User is enabled and Add User is disabled.
In the code I have a little jQuery:
function
onCheck(e) {
$(
'#checkTreeview'
).change(
function
(){
var
c =
this
.checked ?
'disabled'
:
false
;
var
d =
this
.checked ?
false
:
'disabled'
;
$(
'#addUserButton'
).attr(
'disabled'
, c );
$(
'#modifyUserButton'
).attr(
'disabled'
, d );
});
kendoConsole.log(
"Checkbox changed: "
+
this
.text(e.node));
}
Two things, and I realize this may not be the way to approach, since, after all, it IS failing miserably, despite it being a Friday...
1) For the first item in the treeview, after the first two clicks (check box, uncheck box) it then begins to toggle the buttons appropriately. However, it logs the change to the console consistently, every time.
2) The toggle only works for the first checkbox, and no others;
Clearly, this is the wrong way to approach this, so, in summation, how do I implement this functionality correctly with the treeview?