Results 1 to 4 of 4

Thread: Tree panel nodes not visible in collapse mode

  1. #1

    Default Tree panel nodes not visible in collapse mode

    I have a problem with my tree panel,

    when the tree is collapsed I can't navigate the hidden nodes. in practice only the head is considered

    I have checkboxes in every node of the tree and when I go to select them in expanded mode it works the reading, while when it collapsed it reads me only the first node

    Code:
    Ext.define('Project.myTreePanel', {
                extend: 'Ext.tree.Panel',
                xtype: 'myTreePanel',
                controller: 'myTreePanel',
                viewModel: 'myTreePanel',


    in the controller I go to read every check with a for each, but the unchecheck values ​​are considered only if visible (not compressed from the tree)
    Code:
    onSaveClick: function(){
    var ctr = this;
    var view = ctr.getView();
     var store = ctr.getView().getStore();
                            var uncheckedElements = [];
                            var checkedElements = [];
                            
                            store.each(function(rec){
                                var elemento;
                                   if(!rec.data.checked){
                                    uncheckedElements.push(elemento);
                                }else{
                                    checkedElements.push(elemento);
                                }    
                           }     
    }
    can someone help me?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892
    Answers
    41

    Default

    The overview of the TreeStore class needs to be upgraded in the API docs.

    The way it works is that when a node "parent" is expanded, its childNodes are inserted into the TreeStore just after "parent".

    And when the node collapses, its childNodes are removed from the TreeStore.

    The TreeStore only contains the expanded structure. This is because the Store content is what is mapped to the UI. The Tree is just a Grid with a fancy first column.

    What you need is https://docs.sencha.com/extjs/6.6.0/...ml#method-each

    Note the includeOptions parameter.

  3. #3

    Default

    Thank you for the reply
    The store I use is a TreeStore

    Code:
    Ext.define('Trk.store.MyStore', {
        extend: 'Ext.data.TreeStore',
    
        alias: 'store.myStore',
    then I tried to use each with the option you indicated to me, but it seems to maintain the same behavior.

    Code:
    var unchecked = [];
    
    
    var myDataToBeSend = [];
    var includeOption = {};
    
    includeOption.collapsed = true;
    
    store.each(function(rec) {
    
     if (!rec.data.checked) {
    
      unchecked.push({
       'idMag': rec.data.idTrkSitoMag
      });
    
     } else {
      var elemento = {
       'idMag': rec.data.idTrkSitoMag,
       'idVettore': rec.data.idVettore,
       'idVettore2': rec.data.idVettore2
      };
      myDataToBeSend.push(elemento);
     }
    }, null, includeOption);
    some idea?

  4. #4

    Default

    IT WORKS!

    Code:
                        var unchecked = [];
    
                        var lengthTree = store.getData().length;
                        var myDataToBeSend = [];
                        
                        store.each(function(rec) {
                         if (!rec.data.checked) {
                          if (rec.data.idTrkSitoMag != null && rec.data.idTrkSitoMag > 0) {
                           unchecked.push({
                            'idMag': rec.data.idTrkSitoMag
                           });
                          }
                         } else {
                          var elemento = {
                           'idMag': rec.data.idTrkSitoMag,
                           'idVettore': rec.data.idVettore,
                           'idVettore2': rec.data.idVettore2
                          };
                          myDataToBeSend.push(elemento);
                         }
                        }, this, {
                         collapsed: true
                        });
    thank you for support

Similar Threads

  1. Custom Icons are not visible for Tree nodes
    By sandeep.yerkala in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 27 Oct 2016, 12:11 AM
  2. Replies: 1
    Last Post: 30 May 2014, 7:35 AM
  3. Get checked nodes ids in edit mode without expanding it in tree panel
    By auminfosys in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 29 Jun 2010, 9:07 AM

Posting Permissions

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