Dynamic tree Store Ext js



  • Trying to implement the Dynamic tree StoreExt js in the facade json and I'll give it to the parentId. But I can't make him become childom

    mine tree

    treeFactory : function(treeName, lStore, lColumns) {
            Ext.define(treeName, {
                extend : 'Ext.tree.Panel',
                alias : 'widget.dictree1',
                border : false,
                store : lStore,
                collapsible : false,
                useArrows: false,
                rootVisible: false,
                rootText: 'Справочники',
                rootId: 'root',
                columns : lColumns,
                autoScroll : true
            });
            return Ext.create(treeName);
        },
    

    my store

    storeFactory : function(storeName, lModel) {
            Ext.define(storeName, {
                extend : 'Ext.data.TreeStore',
                model : lModel,
                parentIdProperty: 'parentId',
                autoLoad : false,
                root: {
                    text: 'Справочники',
                    expanded: true,
                    id: 'root'
                },
                proxy : {
                    type : 'rest',
                    noCache : true,
                    url : 'services/ClsTreeResource',
                    reader : 'json',
                    headers : {
                        Accept : 'application/json'
                    }
                }
            });
            return Ext.create(storeName);
        },
    

    mine model

    modelFactory : function(modelName, lFields) {
            return Ext.define(modelName, {
                extend : 'Ext.data.Model',
                idProperty : 'id',
                fields : lFields,
                hasMany : [ {
                    name : 'childern',
                    model : modelName,
                    associationKey : 'childern'
                } ]
            });
        },
    

    part of the code on facade id 20 is a parent. id 40 is supposed to be him. childom

    clsDTO = new ClsDTO();
                    clsDTO.setId(20);
                    clsDTO.setParentId(0);
                    clsDTO.setNameRu(properties.getProperty("monitoring.menumode.enum." + lang));
                    answ.add(clsDTO);
    
                clsDTO = new ClsDTO();
                clsDTO.setId(40);
                clsDTO.setParentId(20);
                clsDTO.setNameRu(properties.getProperty("byindate.menumode.enum." + lang));
                clsDTO.setLeaf(properties.getProperty("byindate.menumode.enum.leaf"));
                answ.add(clsDTO);
    

    The result was never achieved. child For the steward, how?



  • You don't have to hand over the subsidiaries by pointing out parentId♪ Field parentId We need to: When you click on the parent, he's sending a variable node to the server. ID Mother. On the server, you make a sample of who. parentId = node and return. json




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2