Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8868913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:21:57+00:00 2026-06-14T17:21:57+00:00

I am newbie extJs user. I have using tree panel with checkbox and i

  • 0

I am newbie extJs user. I have using tree panel with checkbox and i want to uncheck the parent node when the children node is not all checked. below is my code, hope you can help me guys, i dont know what to do here.

the structure of my treepanel is something like this:

  • parentnode1
    • sub-parentNode1.1
      • child1.1
      • child1.2
      • child1.3
    • subparentNode1.2
      • child2.1
      • child2.2
  • parentnode2
    • subparentNode2.1
      • child2.1.1

var treeCheck = new Ext.tree.TreePanel({
    //some code here
});

//event here

treeCheck.on('checkchange', function(node, checked) {
    if(node.hasChildNodes()==true) {

        node.eachChild(function(n) {
            n.getUI().toggleCheck(checked);
        });

    } else {

        if(!checked) {
            var _parentNode = node.parentNode;
            //i dont know what to do here...
            //specifically, i want to uncheck the parent node and subparent node
            //when the children/child node is unchecked
        }
    }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:21:58+00:00Added an answer on June 14, 2026 at 5:21 pm

    Had the same issue. Fixed it by adding this event handler:

    treePanel.on('checkchange', function(node, isChecked) {
    
        // Propagate change downwards (for all children of current node).
        var setChildrenCheckedStatus = function (current) {
            if (current.parentNode) {
                var parent = current.parentNode;
                current.set('checked', parent.get('checked'));
            }
    
            if (current.hasChildNodes()) {
                current.eachChild(arguments.callee);
            }
        };
        if (node.hasChildNodes()) {
            node.eachChild(setChildrenCheckedStatus);
        }
    
        // Propagate change upwards (if all siblings are the same, update parent).
        var updateParentCheckedStatus = function (current) {
            if (current.parentNode) {
                var parent = current.parentNode;
    
                var checkedCount = 0;
                parent.eachChild(function(n) {
                    checkedCount += (n.get('checked') ? 1 : 0);
                });
    
                // Children have same value if all of them are checked or none is checked.
                var sameValue = (checkedCount == parent.childNodes.length) || (checkedCount == 0);
    
                if (sameValue) {
                    var checkedValue = (checkedCount == parent.childNodes.length);
                    parent.set('checked', checkedValue);
                } else {
                    // Not all of the children are checked, so uncheck the parent.
                    parent.set('checked', false);
                }
    
                updateParentCheckedStatus(parent);
            }
        }
        updateParentCheckedStatus(node);
    });
    

    Works both ways, downwards (check all children of a node) and upwards (uncheck parent nodes if a node is unchecked) in a recursive manner.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie question since I'm not up to speed using maven at all. I'm trying
I'm a newbie using Extjs 4.07. I have created a combobox (remote) queryMode. The
i'm a newbie with ExtJS, i'm using ExtJS 4.0.7 and what they call MVC,
Newbie IIS question: I want to setup HTTPS access for my XHTML page (not
ExtJs/Sencha newbie here. Trying to debug something that does not work in a large
Newbie ask: Did I miss something? Loaded scripts http://extjs.cachefly.net/ext-3.2.1/adapter/ext/ext-base.js http://extjs.cachefly.net/ext-3.2.1/ext-all.js Code Ext.onReady(function() { Ext.Ajax.request({
Newbie question... I have setup an application using Coldfusion/MySQL/Apached Webserver on my localhost. I
Newbie in testing. I generated a test case using Selenium, and then exported it
newbie here, so thanks in advance for help! I have a Wordpress site with
Newbie question... The objective: I intend to have an HTML text input field as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.