This question is locked. New answers and comments are not allowed.
Hi folks,
Two questions. Firstly, I'm using this JavaScript currently to check all children.
What I would like, though, is for the children to be checked only when the item is expanded (only let items the user can see, to be checked). How would I accomplish this?
Second, is there any way to save all expanded nodes (even if it was just the first level) in a cookie, and re-expand them next load? I am using LoadOnDemand/AJAX binding, so the solution I saw already about setting a cookie wouldn't work in this case.
Thanks!
Two questions. Firstly, I'm using this JavaScript currently to check all children.
function
onTreeDataBound(e) {
$(
'#AjaxTreeView'
).find(
"li:has(ul)"
)
.find(
'> div > .t-checkbox :checkbox'
)
.bind(
'click'
,
function
(e) {
var
isChecked = $(e.target).is(
':checked'
);
var
treeView = $($(e.target).closest(
'.t-treeview'
)).data(
'tTreeView'
);
var
checkboxes = $(e.target).closest(
'.t-item'
)
.find(
'> ul > li > div > .t-checkbox :checkbox'
);
$.each(checkboxes,
function
(index, checkbox) {
$(checkbox).attr(
'checked'
, isChecked ?
true
:
false
);
treeView.checkboxClick(e, checkbox);
});
});
}
What I would like, though, is for the children to be checked only when the item is expanded (only let items the user can see, to be checked). How would I accomplish this?
Second, is there any way to save all expanded nodes (even if it was just the first level) in a cookie, and re-expand them next load? I am using LoadOnDemand/AJAX binding, so the solution I saw already about setting a cookie wouldn't work in this case.
Thanks!