Results 1 to 6 of 6

Thread: Hide a Node in tree grid

  1. #1
    Sencha User
    Join Date
    Jan 2015
    Posts
    99
    Answers
    11

    Default Hide a Node in tree grid

    Hi all,

    Is there a way to hide a node (a parent or a child) in a treegrid? I set the visible property to false but it does not disappear:


    Do you have any idea how to do it?

    Thanks a lot !

  2. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    something like this for one node:

    for all the nodes you need to make recursion.
    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  3. #3
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    Or so, if you want to remove (not hide) the node.

    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  4. #4
    Sencha User
    Join Date
    Jan 2015
    Posts
    99
    Answers
    11

    Default

    Hi yeghikyan, thanks for you answers, unfortunately, the behaviors are not the behaviors I excpected (and don't work when I collapse other items). I also don't want to remove/add records in the store as I know it's bug and will not work on tree grid. I thought that the node interface would provide a hide config, but it doesn't :/. I used the grid filtering but it's also bugged ! Any ideas anyone ?

  5. #5

    Default

    For ExtJS 6, for example, when read config is false, hide the node:


    Code:
        hideItemsReadFalse: function () {
            var me = this,
                items = me.getReferences().treelistRef.itemMap;
        
        
            for(var i in items){
                if(items[i].config.node.data.read == false){
                    items[i].destroy();
                }
            }
        }


    Root:




    Code:
     {
            "text": "root",
            "children": [
                {
                    "text": "Atualizao",
                    "iconCls": "x-fa fa-list",
                    "children": [
                        {
                            "leaf":true,
                            "text": "Empresas",
                            "module": "empresas",
                            "iconCls": "x-fa fa-building",
                            "read": false
                        },
                        {
                            "leaf":true,
                            "text": "Produtos",
                            "module": "produtos",
                            "iconCls": "x-fa fa-cubes",
                            "read": true
                        }
                    ]
                }
            ]
        }
    Thanks
    Albanir Neves

  6. #6
    Ext JS Premium Member
    Join Date
    Feb 2011
    Posts
    35
    Answers
    2

    Default

    In ExtJS 6.6 property 'visible' can be used to hide node

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •