2016-11-04 6 views
0

私は、デフォルトで選択された子ノードを表示する必要があるブレッドクラムツールバーを使用しています。私はtreestoreを使用しています。rootは私が作成しているもので、次にchildnodesを取得するためにajax呼び出しを行います。私の見解では、デフォルトで選択を選択しています:pStore.getRoot()。childNodes [2]、それは私にnullを与えます。 でもpStore.getRoot()。firstChildはnullを返します。私は何が欠けているか確信していない。 何か助けていただければ幸いです。デフォルトでextjs内の子ノードを選択する方法

ありがとうございます!

ストア

Ext.define('Online.store.Publications', 
     { 
     extend  : 'Ext.data.TreeStore', 
     alias  : 'store.Publications', 
     nodeParam : 'id', 
     autoLoad  : true, 
     root  : { 
     text  : 'Pubs   ►', 
     id   : 'pub', 
     expanded : true, 
     iconCls  : 'doc-folder', 
     leaf  : false 
     }, 
     rootVisible : false, 
     proxy  : { 
     type  : 'ajax', 
     noCache  : false, 
     url   : Online.getBaseURL()+'/nPub/getPublicationsJSON', 
     reader  : { 
      type : 'json' 
     }, 
     timeout  : 60000, 

     } 
     } 
    }); 

ビュー

Ext.define('Online.view.Breadcrumb', { 
     extend  : 'Ext.toolbar.Toolbar', 
     xtype  : 'navigation-toolbar', 
     id   : 'navigation-toolbar', 
     requires : [ 
        'Online.view.BreadcrumbController' 
     ], 
     controller : 'breadcrumb', 
     reference : 'navigation-toolbar', 

     initComponent : function() { 
     var pStore = Ext.create('store.Publications'); 
     )); 
     Ext.apply(this, { 
      items  : [ 
         { 
        xtype   : 'breadcrumb', 

        id    : 'navigation-breadcrumb', 
        reference  : 'breadcrumb', 
        useSplitButtons : false, 
        flex   : 0.85, 
        showIcons  : false, 
        useArrows  : true, 
        bind   : { 
         selection : '{id}' 
        }, 
        store   : pStore, 
        selection  : pStore.getRoot(), 
        autoLoad  : false, 
        rootVisible  : fals 
       }          
      ] 
     }); 
     this.callParent(); 
    } 
}); 
+0

問題を示す煎じ薬を作ってください。 – Alexander

答えて

0
Ext.define('Online.view.Breadcrumb', { 
    extend  : 'Ext.toolbar.Toolbar', 
    xtype  : 'navigation-toolbar', 
    id   : 'navigation-toolbar', 
    requires : [ 
       'Online.view.BreadcrumbController' 
    ], 
    controller : 'breadcrumb', 
    reference : 'navigation-toolbar', 

    initComponent : function() { 
    var pStore = Ext.create('store.Publications'); 
    var PChilds; 
    )); 
    Ext.apply(this, { 
     items  : [ 
        { 
       xtype   : 'breadcrumb', 

       id    : 'navigation-breadcrumb', 
       reference  : 'breadcrumb', 
       useSplitButtons : false, 
       flex   : 0.85, 
       showIcons  : false, 
       useArrows  : true, 
       bind   : { 
        selection : '{id}' 
       }, 
       store   : pStore, 
       selection  :'', 
       autoLoad  : false, 
       rootVisible  : fals 
      }          
     ] 
    }); 

      ***pStore.on('load', function(store, records) { 
      PChilds = pStore.getRootNode().childNodes[0] 
      var nodeObj = this.items.items[1]; 
      nodeObj.setSelection(PChilds); 
     },this);*** 
    this.callParent(); 
} 

});

関連する問題