Results 1 to 2 of 2

Thread: 7.1 NodeInterface replaceChild : nodes not in the correct order

  1. #1
    Sencha Premium User
    Join Date
    Apr 2013
    Posts
    15

    Default 7.1 NodeInterface replaceChild : nodes not in the correct order

    Hello,



    I has a TreePanel :

    PHP Code:
    Ext.define('common.calculs.arbreCalculs.ArbreCalculs', {
                    
    extend'Ext.tree.Panel',
                    
    xtype:  'arbreCalculs',

                   
                   
                    
    requires: [
                                   
    'common.calculs.arbreCalculs.ArbreCalculs_c',
                                   
    'common.calculs.FenetreSaisieValeur'
                    
    ],
                   
                    
    controller'ArbreCalculs',
                   
                   
                    
    autoScrolltrue,
                    
    useArrowstrue,
                    
    rootVisibletrue,
                   
                    
    config:{
                                   
    requeteValidenull,
                                   
    nodeCopienull
                    
    },
                   
                   
                   
                    
    initComponent: function() {
                                  
                                  
                                   var 
    methis;
                                  
                                   
    this.structureDonnees=[
                                                   
    'text',
                                                   
    'typeElement',
                                                   
    'identifiant',
                                                   
    'identifiantOrigine',
                                                   
    'comportement',
                                                   
    'module',
                                                   
    'operateur',
                                                   
    'format',
                                                   
    'formatDonnee',
                                                   
    'debutChaine',
                                                   
    'tailleChaine',
                                                   
    'valeurSaisie',
                                                   
    'typeSaisie',
                                                   
    'libelleValeur',
                                                   
    'table',
                                                   
    'champ',
                                                   
    'typeConversion',
                                                   
    'iconCls',
                                                   
    'expanded',
                                                   
    'referenceColonne'
                                   
    ],
                                  
                                  
                                   
    this.racineCalcul={
                                                   
    text'...',
                                                   
    typeElement'vide',
                                                   
    iconCls'vide',
                                                   
    identifiant'racine',
                                                   
    expandedtrue,
                                                   
    expandablefalse,
                                                   
    children: [],
                                                   
    comportement: {
                                                                   
    remplacement: {
                                                                                   
    typesElementRemplacement: [{
                                                                                                  
    typeElement"fonction"
                                                                                   
    }, {
                                                                                                  
    typeElement"donnee"
                                                                                   
    }, {
                                                                                                  
    typeElement"valeurSaisie"
                                                                                   
    }, {
                                                                                                  
    typeElement"colonne"
                                                                                   
    }]
                                                                   },
                                                                   
    menuContextuel:[{
                                                                                                  
    "menu":"collerElement"
                                                                   
    }]
                                                   }
                                   };
                                  
                                  
                                   
    this.menuContextuel=Ext.create('Ext.menu.Menu',{
                                                   
    plaintrue
                                                   
    items : [{
                                                                   
    text:'Initialiser',
                                                                   
    identifiant'initElement',
                                                                   
    listeners: {
                                                                                   
    click'initElement',
                                                                                   
    scopeme.controller
                                                                   
    }
                                                   },{
                                                                   
    text:'Modifier la valeur...',
                                                                   
    identifiant'saisieValeur',
                                                                   
    listeners: {
                                                                                   
    click'saisieValeur',
                                                                                   
    scopeme.controller
                                                                   
    }
                                                   },{
                                                                   
    text:'Supprimer',
                                                                   
    identifiant'suppElement',
                                                                   
    listeners: {
                                                                                   
    click'SupprElement',
                                                                                   
    scopeme.controller
                                                                   
    }
                                                   },{
                                                                   
    text:'Copier',
                                                                   
    identifiant'copierElement',
                                                                   
    listeners: {
                                                                                   
    click'copierElement',
                                                                                   
    scopeme.controller
                                                                   
    }
                                                   },{
                                                                   
    text:'Coller',
                                                                   
    identifiant'collerElement',
                                                                   
    disabledtrue,
                                                                   
    listeners: {
                                                                                   
    click'collerElement',
                                                                                   
    scopeme.controller
                                                                   
    }
                                                   }]
                                   });
                                  
                                  
                                  
                                  
                                  
                                   
    this.storeExt.create('Ext.data.TreeStore',{
                                                   
    fields:me.structureDonnees,
                                                    
    root: {
                                                                   
    text'Calcul',
                                                                   
    draggable:false,
                                                                   
    id'root',
                                                                   
    typeElement'racine',
                                                                   
    iconCls'vide',
                                                                   
    expandedtrue,
                                                                   
    children: [me.racineCalcul]
                                                   },
                                                   
    listeners: {
                                                                   
    datachanged'datachanged',
                                                                   
    scopeme.controller
                                                   
    }
                                   });
                                  
                                  
                                   
    this.viewConfig= {
                                                   
    loadMaskfalse,
                                                   
    plugins: [{
                                                                   
    id'donneesCalculeesDD',
                                                                   
    ptype'treeviewdragdrop',
                                                                   
    ddGroup'donneesCalculees',
                                                                   
    enableDragfalse,
                                                                   
    enableDroptrue,
                                                                   
    appendOnlytrue
                                                                   
                                                   
    }]
                                   };
                                  
                                  
                                   
    this.callParent(arguments);
                    },
                   
                   
                   
                    
    listeners: {
                                   
    beforedrop'beforedrop',
                                   
    drop'drop',
                                   
    beforeitemcontextmenu'beforeitemcontextmenu',
                                   
    itemdblclick'itemdblclick',
                                   
    itemcontextmenu'itemcontextmenu',
                                   
    scope'controller'
                                  
                    
    }
                   
    }); 


    by drag and drop I add a node with replaceChild method

    for nodes with 2 nested levels it's Ok but with 3 levels the nodes are not in the correct order

    NOK.JPG

    If I collapse and expand the root node it's ok

    OK.JPG

    https://fiddle.sencha.com/#view/editor&fiddle/32qf

  2. #2
    Sencha Premium User
    Join Date
    Mar 2017
    Posts
    32

    Default

    Hi,

    You need to set leaf: true to each node that has no child

    Hope this helps

Posting Permissions

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