This is a migrated thread and some comments may be shown as answers.

Check all children who are visible?

0 Answers 21 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ryan
Top achievements
Rank 1
Ryan asked on 24 Feb 2011, 10:24 PM
I'm using this script to check only visible 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:visible > .t-checkbox :checkbox');
                    $.each(checkboxes, function (index, checkbox) {
                        $(checkbox).attr('checked', isChecked ? true : false);
                        treeView.checkboxClick(e, checkbox);
                    });
                });
}

This only works for the level directly beneath the parent. I'd like to check all visible-subchildren (grandchildren, great-grandchildren etc) as well. I'm not quite the jQuery guru yet, so any assistance would be appreciated. Thanks!
Tags
TreeView
Asked by
Ryan
Top achievements
Rank 1
Share this question
or